From bbc8878e6dcd491d89529c92d9247781751296d7 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Sun, 29 May 2005 12:20:41 +0000 Subject: [PATCH] Fix check for leading zero, so that it does not block two zeroes in hook name. --- sys/netgraph/ng_ipfw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/netgraph/ng_ipfw.c b/sys/netgraph/ng_ipfw.c index 031a6157d28..f2e4a7f4dbb 100644 --- a/sys/netgraph/ng_ipfw.c +++ b/sys/netgraph/ng_ipfw.c @@ -147,9 +147,13 @@ ng_ipfw_newhook(node_p node, hook_p hook, const char *name) const char *cp; char *endptr; + /* Protect from leading zero */ + if (name[0] == '0' && name[1] != '\0') + return (EINVAL); + /* Check that name contains only digits */ for (cp = name; *cp != '\0'; cp++) - if (!isdigit(*cp) || (cp[0] == '0' && cp[1] != '\0')) + if (!isdigit(*cp)) return (EINVAL); /* Convert it to integer */