summaryrefslogtreecommitdiff
path: root/sbin/ping6/ping6.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-08-18 20:42:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-08-18 20:42:29 +0000
commitf8a38455e6fe3bd731393fead4bc47d455a29ab8 (patch)
treef92f7a58359861ebcbb178137446c8e5beac405b /sbin/ping6/ping6.c
parent5c8c22d61aadea94296688843aceebea419e7f38 (diff)
also handle snprintf() < 0
Diffstat (limited to 'sbin/ping6/ping6.c')
-rw-r--r--sbin/ping6/ping6.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index 1c0284ae223..66d5a4c0fae 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping6.c,v 1.32 2001/07/07 18:26:18 deraadt Exp $ */
+/* $OpenBSD: ping6.c,v 1.33 2001/08/18 20:42:28 deraadt Exp $ */
/* $KAME: ping6.c,v 1.129 2001/06/22 13:16:02 itojun Exp $ */
/*
@@ -1348,7 +1348,7 @@ dnsdecode(sp, ep, base, buf, bufsiz)
while (i-- > 0 && cp < ep) {
l = snprintf(cresult, sizeof(cresult),
isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff);
- if (l >= sizeof(cresult))
+ if (l >= sizeof(cresult) || l < 0)
return NULL;
if (strlcat(buf, cresult, bufsiz) >= bufsiz)
return NULL; /*result overrun*/