summaryrefslogtreecommitdiff
path: root/src/cli_val.l
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2008-02-26 18:12:29 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2008-02-26 18:12:29 -0800
commitd777950023130447aaafa67df6bea41f67bcf8e0 (patch)
tree316c497555782f67d2052d70e93643278254cfd3 /src/cli_val.l
parentf9ee85510c958f07191cdbb7c3f57f2cf226a6d3 (diff)
downloadvyatta-cfg-d777950023130447aaafa67df6bea41f67bcf8e0.tar.gz
vyatta-cfg-d777950023130447aaafa67df6bea41f67bcf8e0.zip
fix for bug 2749: add u32 range check
Diffstat (limited to 'src/cli_val.l')
-rw-r--r--src/cli_val.l12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cli_val.l b/src/cli_val.l
index 5856cea..c24a6dc 100644
--- a/src/cli_val.l
+++ b/src/cli_val.l
@@ -1,4 +1,7 @@
%{
+#define __USE_ISOC99
+#include <limits.h>
+
#include "cli_val.h"
#include "cli_parse.h"
#include "cli_objects.h"
@@ -226,6 +229,15 @@ false {
}
[0-9]+ {
+ long long int cval = 0;
+ char *endp = NULL;
+ errno = 0;
+ cval = strtoll(yytext, &endp, 10);
+ if ((errno == ERANGE && (cval == LLONG_MAX || cval == LLONG_MIN))
+ || (errno != 0 && cval == 0)
+ || (*endp != '\0') || (cval < 0) || (cval > UINT_MAX)) {
+ return SYNTAX_ERROR;
+ }
make_val_value(INT_TYPE);
return VALUE;
}