summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-05-31 18:15:14 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-05-31 18:15:14 -0700
commit0cf868f7928a47a0f1ab429ee004e314572005a7 (patch)
treeb8e7ee8be16e648fe1c0ed49f8ae8f99d8a4cbe4 /src
parent84c9b55a994cacbd5395c9ed2c5bf85834e60c13 (diff)
downloadvyatta-cfg-0cf868f7928a47a0f1ab429ee004e314572005a7.tar.gz
vyatta-cfg-0cf868f7928a47a0f1ab429ee004e314572005a7.zip
fix for bug 5649. Need to initialize val_types for value comparison to ERROR_TYPE
Diffstat (limited to 'src')
-rw-r--r--src/cli_def.l1
-rw-r--r--src/cli_new.c8
-rw-r--r--src/cli_val.l1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/cli_def.l b/src/cli_def.l
index a7de87d..0b4e5b0 100644
--- a/src/cli_def.l
+++ b/src/cli_def.l
@@ -154,6 +154,7 @@ return_value(vtw_type_e type)
yy_cli_parse_lval.val.free_me = TRUE;
yy_cli_parse_lval.val.val = strdup(yy_cli_def_text);
yy_cli_parse_lval.val.val_type = type;
+ yy_cli_parse_lval.val.val_types = NULL;
return VALUE;
}
diff --git a/src/cli_new.c b/src/cli_new.c
index bfd2d8c..3e98756 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -850,6 +850,7 @@ int char2val_text(vtw_def *def, char *value, valstruct **valpp)
//PROCESSING IF TYPE IS TEXT TYPE
valp->val_type = TEXT_TYPE;
+ valp->val_types = NULL;
valp->free_me = TRUE;
/* count lines */
linecnt = 0;
@@ -872,6 +873,10 @@ int char2val_text(vtw_def *def, char *value, valstruct **valpp)
cnt *= MULTI_ALLOC;
valp->vals = my_malloc(cnt * sizeof(char *), "char2val 2");
valp->val_types = my_malloc(cnt * sizeof(vtw_type_e), "char2val 3");
+ int i;
+ for (i=0;i<cnt;++i) {
+ valp->val_types[i] = ERROR_TYPE;
+ }
for(cp = value, cnt = 0; cnt < linecnt; ++cnt) {
endp = strchr(cp, '\n');
if (endp)
@@ -929,6 +934,7 @@ boolean val_cmp(const valstruct *left, const valstruct *right, vtw_cond_e cond)
//don't bother comparing if these are different types.
if ((rcur || right->cnt)
+ && right->val_types != NULL
&& right->val_types[rcur] != ERROR_TYPE) {
if (right->val_types[rcur] != val_type) {
continue;
@@ -957,6 +963,7 @@ boolean val_cmp(const valstruct *left, const valstruct *right, vtw_cond_e cond)
left_parts+5);
if ((rcur || right->cnt)
+ && right->val_types != NULL
&& right->val_types[rcur] != ERROR_TYPE) {
format = cond_formats[right->val_types[rcur]];
}
@@ -1400,6 +1407,7 @@ static int eval_va(valstruct *res, vtw_node *node)
if(status==0) {
if(cv.value) {
res->val_type = cv.val_type;
+ res->val_types = NULL;
res->free_me = TRUE;
res->val = cv.value;
}
diff --git a/src/cli_val.l b/src/cli_val.l
index c24a6dc..b2911a6 100644
--- a/src/cli_val.l
+++ b/src/cli_val.l
@@ -284,6 +284,7 @@ static void make_val_value(vtw_type_e type)
get_cli_value_ptr()->free_me = TRUE;
get_cli_value_ptr()->val = my_strdup(yytext, "cli_val.l");
get_cli_value_ptr()->val_type = type;
+ get_cli_value_ptr()->val_types = NULL;
}