summaryrefslogtreecommitdiff
path: root/lib/grammar_sandbox.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/grammar_sandbox.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/grammar_sandbox.c')
-rw-r--r--lib/grammar_sandbox.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 66e530595b..90aadc6a9f 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -17,6 +17,8 @@ DEFUN (grammar_test,
char* command = argv_concat(argv, argc, 0);
struct cmd_element *cmd = malloc(sizeof(struct cmd_element));
cmd->string = command;
+ cmd->doc = NULL;
+ cmd->func = NULL;
parse_command_format(nodegraph, cmd);
return CMD_SUCCESS;
}
@@ -59,6 +61,9 @@ DEFUN (grammar_test_complete,
fprintf(stderr, "<cr> %p\n", cnode->element->func);
else
fprintf(stderr, "%s\n", describe_node(cnode, desc, 50));
+
+ if (cnode->type == RANGE_GN)
+ fprintf(stderr, "%lld - %lld\n", cnode->min, cnode->max);
}
free(desc);
}