diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-07-28 17:44:48 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2020-07-30 21:02:03 +0000 |
commit | a184701108c2aaf188dbb3d306575abceda55bd9 (patch) | |
tree | 38b37716e25308da92138432995049a9fefbdc08 /src/vty/command.c | |
parent | 9fdc8715323a5ed621050c5541b9d7bd254c93c1 (diff) |
vty: Don't match negative values on purely positive ranges
Without this patch, for instance having a range 0-ULONG_MAX would match
if someones types value -3, which would be converted to unsigned but
that's clearly what is expected here from user point of view.
Change-Id: Ia95f6314a2dd3f94d21fc219cf69bb8d39b8e7f0
Diffstat (limited to 'src/vty/command.c')
-rw-r--r-- | src/vty/command.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vty/command.c b/src/vty/command.c index 16dd07fa..278ceb5d 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -1325,6 +1325,9 @@ static int cmd_range_match(const char *range, const char *str) } else { unsigned long min, max, val; + if (str[0] == '-') + return 0; + val = strtoul(str, &endptr, 10); if (*endptr != '\0') return 0; |