projects
/
project
/
ubox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b7d977e
)
validate: fix length calculation of string literals and store value type for literal...
author
Jo-Philipp Wich
<jow@openwrt.org>
Sat, 30 Nov 2013 16:47:08 +0000
(16:47 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Sat, 30 Nov 2013 17:20:48 +0000
(17:20 +0000)
validate/validate.c
patch
|
blob
|
history
diff --git
a/validate/validate.c
b/validate/validate.c
index a146eda8e664cf04e2e1b6f515e3dfa770967d33..046e4bd30d1c1b7ed57a9910a6b21109b856e3ae 100644
(file)
--- a/
validate/validate.c
+++ b/
validate/validate.c
@@
-99,7
+99,7
@@
dt_test_string(const char *s, const char *end, const char *value)
s++;
}
s++;
}
- return (*s == *value || (s > end && *value == 0));
+ return (*s == *value || (s >
=
end && *value == 0));
}
static bool
}
static bool
@@
-796,7
+796,7
@@
dt_parse_atom(struct dt_state *s, const char *label, const char *end)
{
op->next = p + 1;
op->type = OP_STRING;
{
op->next = p + 1;
op->type = OP_STRING;
- op->length = (p - label) -
2
;
+ op->length = (p - label) -
1
;
op->value.string = label + 1;
op->nextop = ++s->depth;
op->value.string = label + 1;
op->nextop = ++s->depth;
@@
-951,10
+951,14
@@
dt_step(struct dt_state *s)
{
case OP_NUMBER:
rv = dt_test_number(op->value.number, s->value);
{
case OP_NUMBER:
rv = dt_test_number(op->value.number, s->value);
+ if (rv)
+ s->valtype = DT_NUMBER;
break;
case OP_STRING:
rv = dt_test_string(op->value.string, op->value.string + op->length, s->value);
break;
case OP_STRING:
rv = dt_test_string(op->value.string, op->value.string + op->length, s->value);
+ if (rv)
+ s->valtype = DT_STRING;
break;
case OP_FUNCTION:
break;
case OP_FUNCTION: