From 405c9b96cb639da9ff910f0bcafe810e8f58e2e5 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 25 Jan 2016 21:11:34 +0100 Subject: Make sure to always terminate decoded string Write a terminating '\0' to dest when the first byte of the encoded data is 0. This corner case was previously missed. Signed-off-by: Daniel Fahlgren Signed-off-by: Waldemar Brodkorb --- libc/inet/resolv.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libc/inet') diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 5dca90746..4028afcbf 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -674,6 +674,7 @@ int __decode_dotted(const unsigned char *packet, if (!packet) return -1; + dest[0] = '\0'; while (--maxiter) { if (offset >= packet_len) return -1; -- cgit v1.2.3