diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2015-05-25 20:32:41 +0800 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-05-25 23:03:10 +0200 |
commit | 19e29ffc15dbd958e8e6a648ee0982c68353516f (patch) | |
tree | bba4c06715e5aaa39f06a73b6103d38c080398f6 | |
parent | a6a884b368409c0c0af1c1c53f6ad4a1b55648b2 (diff) | |
download | uci-19e29ffc15dbd958e8e6a648ee0982c68353516f.tar.gz |
delta: catch error when parsing delta line.
Reported by sarumpaet [1]
[1] uci fails to handle long values properly,
https://github.com/openwrt/packages/issues/1231
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
-rw-r--r-- | delta.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -293,13 +293,15 @@ static int uci_load_delta_file(struct uci_context *ctx, struct uci_package *p, c UCI_TRAP_SAVE(ctx, done); stream = uci_open_stream(ctx, filename, NULL, SEEK_SET, flush, false); + UCI_TRAP_RESTORE(ctx); + if (p) changes = uci_parse_delta(ctx, stream, p); - UCI_TRAP_RESTORE(ctx); + done: if (f) *f = stream; - else if (stream) + else uci_close_stream(stream); return changes; } |