On Mon, Apr 02 2018, Caspar Schutijser <[email protected]> wrote:
> Hi,
>
> On Tue, Jan 24, 2017 at 11:42:37AM +0100, Janne Johansson wrote:
>> It was pointed out to me that if you run
>> 
>> dig @h.gtld-servers.net ubuntu.com. se-east-1.clouds.archive.ubuntu.com
>> +trace
>> 
>> a few times, it sooner or later gets a reply too large for udp, switches to
>> tcp and then
>> dies with this output:
>> 
>> /usr/src/usr.sbin/bind/lib/dns/name.c:571: REQUIRE((((name2) !=
>>     ((void *)0)) && (((const isc__magic_t *)(name2))->magic == ((('D')
>>          << 24 | ('N') << 16 | ('S') << 8 | ('n')))))) failed.
>
> I ran into this problem as well.  Upstream fixed the bug a while ago
> with commit 084ba95b083dc55fd10631ad43fa8fff48707648, which can be
> viewed here:
> https://source.isc.org/cgi-bin/gitweb.cgi?p=bind9.git;a=patch;h=084ba95b083dc55fd10631ad43fa8fff48707648
>
> Below is a diff that backports this diff to OpenBSD dig.

Thanks for looking into this, the diff indeed fixes the crash here.

Objections/ok?


> Thanks,
> Caspar Schutijser
>
>
> Index: dighost.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bind/bin/dig/dighost.c,v
> retrieving revision 1.17
> diff -u -p -r1.17 dighost.c
> --- dighost.c 1 Jun 2017 20:18:44 -0000       1.17
> +++ dighost.c 2 Apr 2018 10:26:35 -0000
> @@ -758,6 +758,7 @@ make_empty_lookup(void) {
>       looknew->new_search = ISC_FALSE;
>       looknew->done_as_is = ISC_FALSE;
>       looknew->need_search = ISC_FALSE;
> +     dns_fixedname_init(&looknew->fdomain);
>       ISC_LINK_INIT(looknew, link);
>       ISC_LIST_INIT(looknew->q);
>       ISC_LIST_INIT(looknew->my_server_list);
> @@ -832,6 +833,9 @@ clone_lookup(dig_lookup_t *lookold, isc_
>       looknew->need_search = lookold->need_search;
>       looknew->done_as_is = lookold->done_as_is;
>  
> +     dns_name_copy(dns_fixedname_name(&lookold->fdomain),
> +                   dns_fixedname_name(&looknew->fdomain), NULL);
> +
>       if (servers)
>               clone_server_list(lookold->my_server_list,
>                                 &looknew->my_server_list);
> @@ -1568,7 +1572,6 @@ followup_lookup(dns_message_t *msg, dig_
>                               lookup->trace_root = ISC_FALSE;
>                               if (lookup->ns_search_only)
>                                       lookup->recurse = ISC_FALSE;
> -                             dns_fixedname_init(&lookup->fdomain);
>                               domain = dns_fixedname_name(&lookup->fdomain);
>                               dns_name_copy(name, domain, NULL);
>                       }
>
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to