[openwrt/openwrt] hostapd: use strdup on string passed to hostapd_add_iface
LEDE Commits
lede-commits at lists.infradead.org
Fri Jun 21 02:55:22 PDT 2024
nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/032d3fcf7a861b140435b6507b2b0b66361c92f8
commit 032d3fcf7a861b140435b6507b2b0b66361c92f8
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Jun 14 14:17:57 2024 +0200
hostapd: use strdup on string passed to hostapd_add_iface
The data is modified within hostapd_add_iface
Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
package/network/services/hostapd/src/src/ap/ucode.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c
index d344190208..68fb450884 100644
--- a/package/network/services/hostapd/src/src/ap/ucode.c
+++ b/package/network/services/hostapd/src/src/ap/ucode.c
@@ -86,12 +86,16 @@ static uc_value_t *
uc_hostapd_add_iface(uc_vm_t *vm, size_t nargs)
{
uc_value_t *iface = uc_fn_arg(0);
+ char *data;
int ret;
if (ucv_type(iface) != UC_STRING)
return ucv_int64_new(-1);
- ret = hostapd_add_iface(interfaces, ucv_string_get(iface));
+ data = strdup(ucv_string_get(iface));
+ ret = hostapd_add_iface(interfaces, data);
+ free(data);
+
hostapd_ucode_update_interfaces();
return ucv_int64_new(ret);
More information about the lede-commits
mailing list