[OpenWrt-Devel] [PATCH fstools 1/2] blockd: fix vlist memory corruption
Rafał Miłecki
zajec5 at gmail.com
Fri Dec 13 05:05:11 EST 2019
From: Rafał Miłecki <rafal at milecki.pl>
vlist_add() expects key to point a persistent memory as it doesn't make
its copy. Passing blob_attr of current message was resulting in
undefined/random behavior including list corruption and possible
crashes.
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
blockd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blockd.c b/blockd.c
index 88fe168..7375b2b 100644
--- a/blockd.c
+++ b/blockd.c
@@ -255,7 +255,7 @@ block_hotplug(struct ubus_context *ctx, struct ubus_object *obj,
strcpy(_name, devname);
device->target = __target;
strcpy(__target, target);
- vlist_add(&devices, &device->node, blobmsg_get_string(data[MOUNT_DEVICE]));
+ vlist_add(&devices, &device->node, device->name);
}
vlist_flush(&devices);
--
2.21.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list