diff mbox

nss_dns: Fix assertion failure in _nss_dns_getcanonname_r [BZ #19865]

Message ID 56F58AF1.3000908@redhat.com
State New
Headers show

Commit Message

Florian Weimer March 25, 2016, 7:01 p.m. UTC
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

Comments

Mike Frysinger April 10, 2016, 2:30 a.m. UTC | #1
On 25 Mar 2016 20:01, Florian Weimer wrote:
> 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.

lgtm
-mike
diff mbox

Patch

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: