diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2014-11-12 16:59:22 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-12-11 19:59:02 +0300 |
commit | 30e6cca9396f770f3387fff8bef0a6645571c46c (patch) | |
tree | af97065871562a7504e08effe16f3975fab005de /json_script.c | |
parent | 8c6dadbe038509f8428966c03bcf6be83d832904 (diff) |
json_script: fix eval_string().
- Fix handling of "%%".
- Fix length requirement when calling blobmsg_realloc_string_buffer().
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'json_script.c')
-rw-r--r-- | json_script.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/json_script.c b/json_script.c index 0ec7b38..8e7f526 100644 --- a/json_script.c +++ b/json_script.c @@ -416,7 +416,7 @@ static int eval_string(struct json_call *call, struct blob_buf *buf, const char } if (cur_var) { - if (next > str) { + if (end > str) { cur = msg_find_var(call, str); if (!cur) continue; @@ -434,7 +434,7 @@ static int eval_string(struct json_call *call, struct blob_buf *buf, const char cur_len = end - str; } - dest = blobmsg_realloc_string_buffer(buf, cur_len + 1); + dest = blobmsg_realloc_string_buffer(buf, len + cur_len + 1); memcpy(dest + len, cur, cur_len); len += cur_len; } |