From: Felix Fietkau Date: Fri, 14 Jun 2024 12:17:57 +0000 (+0200) Subject: hostapd: use strdup on string passed to hostapd_add_iface X-Git-Tag: v24.10.0-rc1~1424 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=032d3fcf7a861b140435b6507b2b0b66361c92f8;p=thirdparty%2Fopenwrt.git hostapd: use strdup on string passed to hostapd_add_iface The data is modified within hostapd_add_iface Signed-off-by: Felix Fietkau --- diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index d3441902086..68fb450884e 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);