diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2017-03-06 18:16:28 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2017-03-06 18:16:28 +0000 |
commit | d702f193422415766095908d4c396d5228f3491c (patch) | |
tree | 3e27e0657377fd03cf5dd8ed0695bf1e4fc3b526 /lib/libc | |
parent | 402e3f2672241d1c6be396206fab1e171123c8b6 (diff) |
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.c | 8 |
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'; } |