If given a too large 'num_bytes' value, it would cause a NULL ptr dereference. Instead the code will now break out of the loop at the end of the list.
This is done to allow compilation of ares_inet_ntop() by some daily builds picky compilers that otherwise do not need this function.
Existing definition of SPRINTF always resulted in sprintf() being used, and sprintf() returning 'int' is already used throughout the library.
- Replace 'u_char' with 'unsigned char'. - Replace 'u_int' with 'unsigned int'. - use macros ERRNO and SET_ERRNO() for errno handling.
- Remove rcsid. - Adjust header file inclusions. - ares_inet_ntop used only on systems without a proper inet_ntop function.
- Replace tabs with spaces. - Use ANSI C style for function declarations and definitions. - Use sizeof with parentheses.
ares_inet_ntop would trigger an out of bounds write when the representation of the address required 15 characters, due to not taking in account null termination character. Full import of inet_ntop.c from bind-9.5.3rc1 to pull additional fixes.
ares_inet_net_pton would return wrong values when excessively large, and invalid, netmasks are used. Fixes are from bind-9.5.3rc1, issue also described in the WLB-2008080064 advisory.
Define HAVE_INET_NET_PTON only when system's inet_net_pton function is IPv6 capable and is not affected by the WLB-2008080064 advisory. HAVE_INET_NET_PTON_IPV6 is no longer defined nor used.
File resolv.conf may either use a hash '#' or a semicolon ';' character as an indication that the rest of the line is a comment. This fixes not recognizing the semicolon as a valid comment indicator in resolv.conf.
Reply to a CNAME query doesn't contain addresses, causing ares_parse_a_reply() to bail out with ARES_ENODATA Bug: http://groups.google.com/group/nodejs/browse_thread/thread/a1268c9ea5e9ad9b