diff options
author | 2007-05-28 20:09:21 +0000 | |
---|---|---|
committer | 2007-05-28 20:09:21 +0000 | |
commit | 70b1a84d8f8e6ef58841ff5e5dca6a9234cc01e9 (patch) | |
tree | ad31cf3b394df749aaae01ab9c645bd83dd428ee | |
parent | make it compile on i386 (diff) | |
download | wireguard-openbsd-70b1a84d8f8e6ef58841ff5e5dca6a9234cc01e9.tar.xz wireguard-openbsd-70b1a84d8f8e6ef58841ff5e5dca6a9234cc01e9.zip |
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
-rw-r--r-- | usr.sbin/bgpctl/parser.c | 5 |
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); |