summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl/parser.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2007-05-28 20:09:22 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2007-05-28 20:09:22 +0000
commit9f9f06444d7020013d3296008d2fa0ac49bf0399 (patch)
treec751b87a330456820c2e89688b0945efad39c1a4 /usr.sbin/bgpctl/parser.c
parente92d307c16202e9c1248f55db7fa6ff8fae22de5 (diff)
parse_asnum must return 0 (no match) if word is not an as number instead
of bitching and erroring out. worked so far because at the position it kicked in, only asnumor nothing were allowed
Diffstat (limited to 'usr.sbin/bgpctl/parser.c')
-rw-r--r--usr.sbin/bgpctl/parser.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 08059eb10dd..ba4a0f3cead 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.44 2007/04/23 13:05:35 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.45 2007/05/28 20:09:21 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -645,6 +645,9 @@ parse_asnum(const char *word, u_int32_t *asnum)
if (word == NULL)
return (0);
+ if (strlen(word) < 1 || word[0] < '0' || word[0] > '9')
+ return (0);
+
if ((dot = strchr(word,'.')) != NULL) {
*dot++ = '\0';
uvalh = strtonum(word, 0, USHRT_MAX, &errstr);