projects
/
project
/
rpcd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
uci: fix same buffer reuse introduced by previous commit
[project/rpcd.git]
/
uci.c
diff --git
a/uci.c
b/uci.c
index 3bbb9c8878e74ac1bb86bcb1e2251d34f2c0f76a..ef255a8e3a03e880f1afdf1a9cd4c7732aada93e 100644
(file)
--- a/
uci.c
+++ b/
uci.c
@@
-1392,6
+1392,10
@@
rpc_uci_apply(struct ubus_context *ctx, struct ubus_object *obj,
return ret;
}
return ret;
}
+ /* copy SID early because rpc_uci_apply_config() will clobber buf */
+ if (rollback)
+ strncpy(apply_sid, sid, RPC_SID_LEN);
+
for (i = 0; i < gl.gl_pathc; i++) {
char *config = basename(gl.gl_pathv[i]);
struct stat s;
for (i = 0; i < gl.gl_pathc; i++) {
char *config = basename(gl.gl_pathv[i]);
struct stat s;
@@
-1410,7
+1414,6
@@
rpc_uci_apply(struct ubus_context *ctx, struct ubus_object *obj,
globfree(&gl);
if (rollback) {
globfree(&gl);
if (rollback) {
- strncpy(apply_sid, sid, RPC_SID_LEN);
apply_timer.cb = rpc_uci_apply_timeout;
uloop_timeout_set(&apply_timer, timeout * 1000);
apply_ctx = ctx;
apply_timer.cb = rpc_uci_apply_timeout;
uloop_timeout_set(&apply_timer, timeout * 1000);
apply_ctx = ctx;