summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2016-01-25 21:11:34 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-01-31 17:39:53 +0100
commit405c9b96cb639da9ff910f0bcafe810e8f58e2e5 (patch)
tree19c141de37d96719f555116c5dc57b89f867bd12
parentd9c3a16dcab57d6b56225b9a67e9119cc9e2e4ac (diff)
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 <daniel@fahlgren.se> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
-rw-r--r--libc/inet/resolv.c1
1 files changed, 1 insertions, 0 deletions
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;