isc_buffer

Gisle Vanem gvanem at yahoo.no
Fri Sep 23 11:21:08 UTC 2016


I just built Bind9 + tools using MSVC-2015 and get
rubbish in some commands. E.g.:
C:\> nslookup.exe www.vg.no

  Server:         8.8.8.8
  Address:        8.8.8.8#53

  Non-authoritative answer:
  Name:   www.vg.no
  Address: 195.88.55.16²╖Lwç%bδôö≡e♠óO☺≡µÖ☺@   << !!
  Name:   www.vg.no
  Address: 195.88.54.16↑SWwç%bδôö≡e§óO☺≡µÖ☺@   << !!
  Name:   www.vg.no
  Address: 2001:67c:21e0::16

Why is there this trailing garbage after the address?

AFAICS, in nslookup.c, it's printed in printaddr()
at:
  printf("Address: %.*s\n", (int)isc_buffer_usedlength(&b),
	 (char *)isc_buffer_base(&b));

I.e.:
  isc_print_printf ("Address: %.*s\n", (int) ((&b)->used),
                    (char *) ((void *) (&b)->base));

Since I've ensured all '*printf()' are replaced with proper
'isc_print_*' calls. It seems 'b->used' is too high. How can that happen?

Update: I've rebuilt everything with 'ISC_PLATFORM_NEEDSTRTOUL'.
Thus forcing the use of isc_strtoul()'. Then the results are much cleaner:

  Server:         8.8.8.8
  Address:        8.8.8.8#53

  Non-authoritative answer:
  Name:   www.vg.no
  Address: 195.88.54.16
  Name:   www.vg.no
  Address: 195.88.55.16♀  << !! only this
  Name:   www.vg.no
  Address: 2001:67c:21e0::16

I fail to believe MSVC's strtoul() is to blame here.

-- 
--gv


More information about the bind-workers mailing list