mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-08 03:50:48 +00:00
hostapd: use strdup on string passed to hostapd_add_iface
The data is modified within hostapd_add_iface Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 032d3fcf7a861b140435b6507b2b0b66361c92f8) Link: https://github.com/openwrt/openwrt/pull/15898 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
aa27bd7087
commit
80a36594f9
@ -86,12 +86,16 @@ static uc_value_t *
|
|||||||
uc_hostapd_add_iface(uc_vm_t *vm, size_t nargs)
|
uc_hostapd_add_iface(uc_vm_t *vm, size_t nargs)
|
||||||
{
|
{
|
||||||
uc_value_t *iface = uc_fn_arg(0);
|
uc_value_t *iface = uc_fn_arg(0);
|
||||||
|
char *data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (ucv_type(iface) != UC_STRING)
|
if (ucv_type(iface) != UC_STRING)
|
||||||
return ucv_int64_new(-1);
|
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();
|
hostapd_ucode_update_interfaces();
|
||||||
|
|
||||||
return ucv_int64_new(ret);
|
return ucv_int64_new(ret);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user