diff options
author | 2001-08-18 20:42:28 +0000 | |
---|---|---|
committer | 2001-08-18 20:42:28 +0000 | |
commit | a6344b10ede97a8faae7eb2d856cf2743760b206 (patch) | |
tree | eac69ee9c275a2619b33534bab7c0d729e5c57d2 | |
parent | more careful with snprintf result code (diff) | |
download | wireguard-openbsd-a6344b10ede97a8faae7eb2d856cf2743760b206.tar.xz wireguard-openbsd-a6344b10ede97a8faae7eb2d856cf2743760b206.zip |
also handle snprintf() < 0
-rw-r--r-- | sbin/ping6/ping6.c | 4 |
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*/ |