diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-04-18 16:39:26 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-04-18 16:39:26 +0000 |
commit | b032138465fae1634798806d2ab4636d64b1105a (patch) | |
tree | 7c5001a2ba225b9334a95ba413dccaf5f26c0ab9 /usr.sbin/dhcpd | |
parent | b4e534f25b6f5660d62dfc33557ce7979edea5a6 (diff) |
snprintf() return value handling. ok cloder@ henning@
Diffstat (limited to 'usr.sbin/dhcpd')
-rw-r--r-- | usr.sbin/dhcpd/errwarn.c | 4 | ||||
-rw-r--r-- | usr.sbin/dhcpd/print.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/dhcpd/errwarn.c b/usr.sbin/dhcpd/errwarn.c index a76d074a46e..9d92d1cde9d 100644 --- a/usr.sbin/dhcpd/errwarn.c +++ b/usr.sbin/dhcpd/errwarn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: errwarn.c,v 1.5 2005/04/11 19:59:07 deraadt Exp $ */ +/* $OpenBSD: errwarn.c,v 1.6 2005/04/18 16:39:25 moritz Exp $ */ /* Errors and warnings... */ @@ -175,6 +175,8 @@ do_percentm(char *obuf, size_t size, char *ibuf) ++s; prlen = snprintf(t, fmt_left, "%s", strerror(saved_errno)); + if (prlen == -1) + prlen = 0; if (prlen >= fmt_left) prlen = fmt_left - 1; t += prlen; diff --git a/usr.sbin/dhcpd/print.c b/usr.sbin/dhcpd/print.c index 69642907582..50facb302d6 100644 --- a/usr.sbin/dhcpd/print.c +++ b/usr.sbin/dhcpd/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.8 2004/05/04 21:25:27 deraadt Exp $ */ +/* $OpenBSD: print.c,v 1.9 2005/04/18 16:39:25 moritz Exp $ */ /* Turn data structures into printable text. */ @@ -57,7 +57,7 @@ print_hw_addr(int htype, int hlen, unsigned char *data) for (i = 0; i < hlen; i++) { int j; j = snprintf(s, slen, "%02x", data[i]); - if (j <= 0) + if (j <= 0 || j >= slen) goto bad; s += strlen(s); |