summaryrefslogtreecommitdiff
path: root/libc/inet
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2016-01-25 20:11:34 (GMT)
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-01-31 16:39:53 (GMT)
commit405c9b96cb639da9ff910f0bcafe810e8f58e2e5 (patch)
tree19c141de37d96719f555116c5dc57b89f867bd12 /libc/inet
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>
Diffstat (limited to 'libc/inet')
-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 5dca907..4028afc 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;