OSDN Git Service

DNS Proxy should not hang on addresses containing null bytes
authorBrian Carlstrom <bdc@google.com>
Wed, 27 Apr 2011 18:47:41 +0000 (11:47 -0700)
committerBrian Carlstrom <bdc@google.com>
Wed, 27 Apr 2011 18:47:41 +0000 (11:47 -0700)
commit0475ae98cd8f45de815d67d1966edaf5997be9a9
tree3773c71e59e67cfce6f0b757cb2b02f7ef27a193
parent14998b1aca89bb75f9e3d3bf080610a9cddce2dd
DNS Proxy should not hang on addresses containing null bytes

Two bugs here:

1.) The gethostbyaddr netd protocol was passing a binary address value
    but the arguments are expected to be strings not containing
    embedded nulls (or probably other special characters). This
    happened reliably with IPv6 addresses which contained nulls. It
    now expects an inet_ntop formatted address.

2.) Although the gethostbyaddr code detected something was wrong, it
    wasn't doing any proper error handling, leaving clients hanging
    waiting for a response. It now sends back an empty response so
    that clients can continue.

A corresponding change will be necesssary in bionic for #1 for DNS
proxying to work, but given the fix for #2, the existing bionic code
will fall back to performing its own gethostbyaddr call.

Bug: 4344448
Change-Id: I2d03bfec0093c67e8052717c0f499f8871bcfb85
DnsProxyListener.cpp
DnsProxyListener.h