summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-04 12:55:18 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-03-04 12:55:18 -0800
commit14c69a606f627187539796f0158dbf181a21dc00 (patch)
tree2316507aeaa62d40ed6bd04ccf45bc726f12c328 /src
parent6194a4338de8e612b925530265db0759a94814c4 (diff)
parent41e72b84ece50e0104e2e58c6452fc6012e2c8c3 (diff)
downloadvyatta-cfg-14c69a606f627187539796f0158dbf181a21dc00.tar.gz
vyatta-cfg-14c69a606f627187539796f0158dbf181a21dc00.zip
Merge branch 'glendale' of suva.vyatta.com:/git/vyatta-cfg into glendale
Diffstat (limited to 'src')
-rw-r--r--src/check_tmpl.c3
-rw-r--r--src/cli_new.c3
-rw-r--r--src/cli_val.l12
3 files changed, 17 insertions, 1 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_new.c b/src/cli_new.c
index 353babd..1ecbe83 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -745,11 +745,12 @@ int char2val(vtw_def *def, char *value, valstruct *valp)
if (!token)
return 0;
if (token != EOL) {
+ fprintf(out_stream, "\"%s\" is not a valid value\n", value);
print_msg("Badly formed value in %s\n",
m_path.path + m_path.print_offset);
if (token == VALUE)
my_free(get_cli_value_ptr()->val);
- return 0;
+ return -1;
}
}
return 0;
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;
}