Fix for PAC script function dnsResolve.  DO NOT MERGE.

Issue: DnsResolveImpl treats hostent’s h_addr_list[0] as a
null terminated ascii string.  h_addr_list is type char** but the data
is null terminated network ordered bytes.

Fix: Convert h_addr_list[0] to a string via inet_ntop.

Note: This change only fixes IPv4 function.
A separate change will be submitted to fix IPv6 function
dnsResolveEx.

Be sure to clear browser cache between test attempts, as pages may be
loaded from cache.  When loaded from cache, PAC processing is skipped.

The simplest PAC file to repoduce the issue:

function FindProxyForURL(url, host) {
  alert(dnsResolve("localhost"));
  return "DIRECT";
}

Change-Id: I78603d1ba953ae40ba8562fe638c197dfa9814cf
Signed-off-by: Jeff Dowling <jeffd.aosp@gmail.com>
(cherry picked from commit 26fca44fe0fac207e900bff88edf95c6be5cd107)

Bug: 31987131
Bug: 29178923
1 file changed
tree: 0c40297c192d8117f76b0bf9941dfb5a89cd0971
  1. Android.mk
  2. LICENSE
  3. MODULE_LICENSE_BSD
  4. NOTICE
  5. README
  6. src/
  7. test/