summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-12-26 03:17:08 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-12-26 03:17:08 +0000
commitb1d89877ccb5ba8c839b388bc4beff21524be406 (patch)
tree5df21bfaccbd1a979124f4641526b44f8f90cae8 /sbin/dhclient
parent11ae3168a9fb071bc26192c3649dad56b390e3ec (diff)
snprintf return value paranoia; henning ok
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/options.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c
index 28d72185dc6..9c8e8fc743f 100644
--- a/sbin/dhclient/options.c
+++ b/sbin/dhclient/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.14 2004/11/02 01:18:45 deraadt Exp $ */
+/* $OpenBSD: options.c,v 1.15 2004/12/26 03:17:07 deraadt Exp $ */
/* DHCP options parsing and reassembly. */
@@ -600,7 +600,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
case 'l':
opcount = snprintf(op, opleft, "%ld",
(long)getLong(dp));
- if (opcount >= opleft)
+ if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
dp += 4;
@@ -608,7 +608,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
case 'L':
opcount = snprintf(op, opleft, "%ld",
(unsigned long)getULong(dp));
- if (opcount >= opleft)
+ if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
dp += 4;
@@ -616,7 +616,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
case 's':
opcount = snprintf(op, opleft, "%d",
getShort(dp));
- if (opcount >= opleft)
+ if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
dp += 2;
@@ -624,7 +624,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
case 'S':
opcount = snprintf(op, opleft, "%d",
getUShort(dp));
- if (opcount >= opleft)
+ if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
dp += 2;
@@ -632,19 +632,19 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
case 'b':
opcount = snprintf(op, opleft, "%d",
*(char *)dp++);
- if (opcount >= opleft)
+ if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
break;
case 'B':
opcount = snprintf(op, opleft, "%d", *dp++);
- if (opcount >= opleft)
+ if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
break;
case 'x':
opcount = snprintf(op, opleft, "%x", *dp++);
- if (opcount >= opleft)
+ if (opcount >= opleft || opcount == -1)
goto toobig;
opleft -= opcount;
break;