From 3ec6f79c1ee27caec678eae2dd7a5edd3bb510fd Mon Sep 17 00:00:00 2001 From: Maxim Konovalov Date: Wed, 25 Sep 2002 11:22:36 +0000 Subject: [PATCH] Do not dump core on 'ipfw add unreach': handling null strings in fill_reject_code(). Please note ipfw/ipfw2.c is not affected. PR: bin/42304 Submitted by: Andy@wantpackets.com MFC after: 1 day --- sbin/ipfw/ipfw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c index 9a87b09607b..c4f00fd756d 100644 --- a/sbin/ipfw/ipfw.c +++ b/sbin/ipfw/ipfw.c @@ -1063,6 +1063,8 @@ fill_reject_code(u_short *codep, char *str) u_long val; char *s; + if (str == '\0') + errx(EX_DATAERR, "missing unreachable code"); val = strtoul(str, &s, 0); if (s != str && *s == '\0' && val < 0x100) { *codep = val;