summaryrefslogtreecommitdiff
path: root/src/network/__dns.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-08 08:49:28 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-08 08:49:28 -0400
commitd104c1f7e22b9745b6028ff8fbc3bc88137ba1c2 (patch)
tree25fe09e1351b87dcb77642fd0102e32044d9938d /src/network/__dns.c
parente2cc0bee118d7a282bdce0b71db433def3022fb6 (diff)
downloadmusl-d104c1f7e22b9745b6028ff8fbc3bc88137ba1c2.tar.gz
musl-d104c1f7e22b9745b6028ff8fbc3bc88137ba1c2.tar.bz2
musl-d104c1f7e22b9745b6028ff8fbc3bc88137ba1c2.tar.xz
musl-d104c1f7e22b9745b6028ff8fbc3bc88137ba1c2.zip
fix broken dns response parsing code that made most ipv6 lookups fail
Diffstat (limited to 'src/network/__dns.c')
-rw-r--r--src/network/__dns.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/network/__dns.c b/src/network/__dns.c
index cdd64299..b53ad4ab 100644
--- a/src/network/__dns.c
+++ b/src/network/__dns.c
@@ -257,10 +257,12 @@ int __dns_count_addrs(const unsigned char *r, int cnt)
int found=0, res, i;
static const int p[2][2] = { { 4, RR_A }, { 16, RR_AAAA } };
- while (cnt--) for (i=0; i<2; i++) {
- res = __dns_get_rr(0, 0, p[i][0], -1, r, p[i][1], 0);
- if (res < 0) return res;
- found += res;
+ while (cnt--) {
+ for (i=0; i<2; i++) {
+ res = __dns_get_rr(0, 0, p[i][0], -1, r, p[i][1], 0);
+ if (res < 0) return res;
+ found += res;
+ }
r += 512;
}
return found;