summaryrefslogtreecommitdiff
path: root/sbin/ifconfig/ifconfig.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-07-03 03:24:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-07-03 03:24:05 +0000
commit75fca2aa3a35362ecff27f0c3041d3f511b51275 (patch)
treed0c647e96313c8d94edf3f50304b78ae1cf249c1 /sbin/ifconfig/ifconfig.c
parentaef6c060ee15355c0490999de3c4679d7bb97e84 (diff)
snprintf/vsnprintf return < 0 on error, rather than -1.
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r--sbin/ifconfig/ifconfig.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 80e123341cc..07b981e8352 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.403 2019/06/28 13:32:44 deraadt Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.404 2019/07/03 03:24:01 deraadt Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -5984,7 +5984,7 @@ in_getaddr(const char *s, int which)
(bits = inet_net_pton(AF_INET, s, &tsin.sin_addr,
sizeof(tsin.sin_addr))) != -1) {
l = snprintf(p, sizeof(p), "%d", bits);
- if (l >= sizeof(p) || l == -1)
+ if (l < 0 || l >= sizeof(p))
errx(1, "%d: bad prefixlen", bits);
in_getprefix(p, MASK);
memcpy(&sin->sin_addr, &tsin.sin_addr, sizeof(sin->sin_addr));