This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] nss_dns: Fix assertion failure in _nss_dns_getcanonname_r [BZ #19865]
- From: Florian Weimer <fweimer at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 25 Mar 2016 20:01:05 +0100
- Subject: [PATCH] nss_dns: Fix assertion failure in _nss_dns_getcanonname_r [BZ #19865]
- Authentication-results: sourceware.org; auth=none
As explained in the bug, this function seems to be dead code in typical
configurations, so there does not seem to be any security impact.
Florian
2016-03-25 Florian Weimer <fweimer@redhat.com>
[BZ #19865]
* resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Restore
original buffer before retry.
diff --git a/resolv/nss_dns/dns-canon.c b/resolv/nss_dns/dns-canon.c
index 5c5c6db..072104f 100644
--- a/resolv/nss_dns/dns-canon.c
+++ b/resolv/nss_dns/dns-canon.c
@@ -154,6 +154,13 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
ptr += rdatalen;
}
}
+
+ /* Restore original buffer before retry. */
+ if (ansp.ptr != buf)
+ {
+ free (ansp.ptr);
+ ansp.ptr = buf;
+ }
}
out: