summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/dhcpd/errwarn.c4
-rw-r--r--usr.sbin/dhcpd/print.c4
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);