summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-05-29 12:20:41 +0000
committerglebius <glebius@FreeBSD.org>2005-05-29 12:20:41 +0000
commit3a975e6c42f6fc958f3ee88f9774beacbe8af711 (patch)
tree2d3d084dd36e2e741c908bed845fff9dbc8421a7 /sys
parent1b8699f3e0a0aaef1aa5078b3ddeabc97f46ab29 (diff)
downloadFreeBSD-src-3a975e6c42f6fc958f3ee88f9774beacbe8af711.zip
FreeBSD-src-3a975e6c42f6fc958f3ee88f9774beacbe8af711.tar.gz
Fix check for leading zero, so that it does not block two zeroes
in hook name.
Diffstat (limited to 'sys')
-rw-r--r--sys/netgraph/ng_ipfw.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netgraph/ng_ipfw.c b/sys/netgraph/ng_ipfw.c
index 031a615..f2e4a7f 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 */
OpenPOWER on IntegriCloud