summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2017-03-06 18:16:27 +0000
committermillert <millert@openbsd.org>2017-03-06 18:16:27 +0000
commite6226167d7d75b00a197b2a6a2b76cfdb2f9364d (patch)
tree05f318fbb5ee4adb2ee9d899bbb7d3c98d447d01 /lib/libc
parentPull in a change from the bind 8 resolver that fixes a potential (diff)
downloadwireguard-openbsd-e6226167d7d75b00a197b2a6a2b76cfdb2f9364d.tar.xz
wireguard-openbsd-e6226167d7d75b00a197b2a6a2b76cfdb2f9364d.zip
size is unsigned so using ==0 not <=0 when checking for buffer exhaustion
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/inet_net_pton.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/net/inet_net_pton.c b/lib/libc/net/inet_net_pton.c
index 61ea34c9067..2aaeac4048a 100644
--- a/lib/libc/net/inet_net_pton.c
+++ b/lib/libc/net/inet_net_pton.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet_net_pton.c,v 1.9 2017/03/06 18:14:41 millert Exp $ */
+/* $OpenBSD: inet_net_pton.c,v 1.10 2017/03/06 18:16:27 millert Exp $ */
/*
* Copyright (c) 2012 by Gilles Chehade <gilles@openbsd.org>
@@ -89,7 +89,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size)
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
&& isascii((unsigned char)src[1]) && isxdigit((unsigned char)src[1])) {
/* Hexadecimal: Eat nybble string. */
- if (size <= 0)
+ if (size == 0)
goto emsgsize;
tmp = 0, dirty = 0;
src++; /* skip x or X. */
@@ -128,7 +128,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size)
goto enoent;
} while ((ch = (unsigned char)*src++) != '\0' &&
isascii(ch) && isdigit(ch));
- if (size-- <= 0)
+ if (size-- == 0)
goto emsgsize;
*dst++ = (u_char) tmp;
if (ch == '\0' || ch == '/')
@@ -186,7 +186,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size)
}
/* Extend network to cover the actual mask. */
while (bits > ((dst - odst) * 8)) {
- if (size-- <= 0)
+ if (size-- == 0)
goto emsgsize;
*dst++ = '\0';
}