From ef66ecf2243d5b975afd2448cd4c01583e04b2bf Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 20 Jan 2016 16:15:19 +0000 Subject: [PATCH] Fix memory corruption on punycode --- contrib/librdns/packet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/librdns/packet.c b/contrib/librdns/packet.c index 630413fdb..6ce3f50fa 100644 --- a/contrib/librdns/packet.c +++ b/contrib/librdns/packet.c @@ -132,7 +132,7 @@ rdns_format_dns_name (struct rdns_resolver *resolver, const char *in, p = in; olen = inlen + 1 + sizeof ("xn--") * labels; - *out = malloc (olen); + *out = malloc (olen + 1); if (*out == NULL) { return false; @@ -222,6 +222,7 @@ rdns_format_dns_name (struct rdns_resolver *resolver, const char *in, goto err; } } + *o = '\0'; *outlen = o - *out; -- 2.39.5