summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormoritz <moritz@openbsd.org>2005-03-06 16:17:23 +0000
committermoritz <moritz@openbsd.org>2005-03-06 16:17:23 +0000
commit8b3b5d21bc5ed301946662ecbeccd49fb3842201 (patch)
treed7bc42971c6f6788208a82568527331ef2fcf46b /lib/libc
parentFilter openprom environment strings with strnvis(); ok deraadt@ krw@ (diff)
downloadwireguard-openbsd-8b3b5d21bc5ed301946662ecbeccd49fb3842201.tar.xz
wireguard-openbsd-8b3b5d21bc5ed301946662ecbeccd49fb3842201.zip
correct snprintf return value checks, where the wrong ptr
was used for calculating the buffer size. ok tedu@ cloder@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/res_debug.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/net/res_debug.c b/lib/libc/net/res_debug.c
index 8f66c7d0095..e0f2a894186 100644
--- a/lib/libc/net/res_debug.c
+++ b/lib/libc/net/res_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_debug.c,v 1.17 2003/06/02 20:18:36 millert Exp $ */
+/* $OpenBSD: res_debug.c,v 1.18 2005/03/06 16:17:23 moritz Exp $ */
/*
* ++Copyright++ 1985, 1990, 1993
@@ -78,7 +78,7 @@
static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_debug.c,v 1.17 2003/06/02 20:18:36 millert Exp $";
+static char rcsid[] = "$OpenBSD: res_debug.c,v 1.18 2005/03/06 16:17:23 moritz Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -1075,7 +1075,7 @@ p_time(value)
ebuf = nbuf + sizeof(nbuf);
if (days) {
if ((tmp = snprintf(p, ebuf - p, "%d day%s",
- PLURALIZE(days))) >= ebuf - nbuf || tmp < 0)
+ PLURALIZE(days))) >= ebuf - p || tmp < 0)
goto full;
p += tmp;
}
@@ -1085,7 +1085,7 @@ p_time(value)
if (p >= ebuf)
goto full;
if ((tmp = snprintf(p, ebuf - p, "%d hour%s",
- PLURALIZE(hours))) >= ebuf - nbuf || tmp < 0)
+ PLURALIZE(hours))) >= ebuf - p || tmp < 0)
goto full;
p += tmp;
}
@@ -1095,7 +1095,7 @@ p_time(value)
if (p >= ebuf)
goto full;
if ((tmp = snprintf(p, ebuf - p, "%d min%s",
- PLURALIZE(mins))) >= ebuf - nbuf || tmp < 0)
+ PLURALIZE(mins))) >= ebuf - p || tmp < 0)
goto full;
p += tmp;
}
@@ -1105,7 +1105,7 @@ p_time(value)
if (p >= ebuf)
goto full;
if ((tmp = snprintf(p, ebuf - p, "%d sec%s",
- PLURALIZE(secs))) >= ebuf - nbuf || tmp < 0)
+ PLURALIZE(secs))) >= ebuf - p || tmp < 0)
goto full;
}
return (nbuf);