summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/ns_name.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/resolv/ns_name.c b/resolv/ns_name.c
index a4f066c9e2..b96a1fe8ab 100644
--- a/resolv/ns_name.c
+++ b/resolv/ns_name.c
@@ -195,12 +195,6 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
 				   it internally.  */
 				*label = 0x41;
 				label = bp++;
-				/* Another simplification: always assume
-				   128 bit number.  */
-				if (bp + 16 >= eom) {
-					__set_errno (EMSGSIZE);
-					return (-1);
-				}
 				++src;
 				while (isxdigit (*src)) {
 					n = *src > '9' ? *src - 'a' + 10 : *src - '0';
@@ -211,6 +205,10 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
 					}
 					n <<= 4;
 					n += *src > '9' ? *src - 'a' + 10 : *src - '0';
+					if (bp + 1 >= eom) {
+						__set_errno (EMSGSIZE);
+						return (-1);
+					}
 					*bp++ = n;
 					++src;
 				}