From 6e1b969bcaca824c560d5b4adb5de8d84e439819 Mon Sep 17 00:00:00 2001 From: millert <> Date: Mon, 6 Mar 2017 18:16:27 +0000 Subject: size is unsigned so using ==0 not <=0 when checking for buffer exhaustion --- src/lib/libc/net/inet_net_pton.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libc/net/inet_net_pton.c b/src/lib/libc/net/inet_net_pton.c index 61ea34c906..2aaeac4048 100644 --- a/src/lib/libc/net/inet_net_pton.c +++ b/src/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 @@ -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'; } -- cgit v1.2.3-55-g6feb