diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/check_tmpl.c | 3 | ||||
-rw-r--r-- | src/cli_val.l | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/check_tmpl.c b/src/check_tmpl.c index 8be1a7f..cbb9aa1 100644 --- a/src/check_tmpl.c +++ b/src/check_tmpl.c @@ -1,5 +1,8 @@ +#define _ISOC99_SOURCE #include <stdlib.h> #include <stdio.h> +#include <string.h> +#include <ctype.h> #include "cli_val.h" 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; } |