소스 검색

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>
Waldemar Brodkorb 8 년 전
부모
커밋
405c9b96cb
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      libc/inet/resolv.c

+ 1 - 0
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;