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
This commit is contained in:
Maxim Konovalov 2002-09-25 11:22:36 +00:00
parent 2da3b2ad29
commit 3ec6f79c1e

View File

@ -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;