summaryrefslogtreecommitdiff
path: root/lib/command_match.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-08-01 18:36:30 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-08-01 18:36:30 +0000
commite648e61a747c6c13ccea7d97066dfb07d4461d96 (patch)
tree69b027a83a6c1bbd41e1a5844a524a2b14c4bb22 /lib/command_match.c
parent1a8c390d4abc7c3f599813ddee6ca3990de7576c (diff)
lib: Fix OOB range parses, variable matches
Variables now allow strings beginning with numbers to match, ranges and numbers are now long long to fix OOB parses resulting in integer wraparounds. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_match.c')
-rw-r--r--lib/command_match.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/command_match.c b/lib/command_match.c
index f7854cbe6d..13dee51fef 100644
--- a/lib/command_match.c
+++ b/lib/command_match.c
@@ -604,7 +604,7 @@ static enum match_type
match_range (struct graph_node *rangenode, const char *str)
{
char *endptr = NULL;
- signed long val;
+ signed long long val;
if (str == NULL)
return 1;
@@ -653,11 +653,11 @@ match_number(struct graph_node *numnode, const char *word)
return num == numnode->value ? exact_match : no_match;
}
-#define VARIABLE_ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
+#define VARIABLE_ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:"
static enum match_type
match_variable(struct graph_node *varnode, const char *word)
{
- return strlen(word) == strspn(word, VARIABLE_ALPHABET) && isalpha(word[0]) ?
+ return strlen(word) == strspn(word, VARIABLE_ALPHABET) ?
exact_match : no_match;
}