WIFI-2502 Fix WM crash due to invalid data

Signed-off-by: Rick Sommerville <rick.sommerville@netexperience.com>
This commit is contained in:
Rick Sommerville
2021-06-04 14:03:55 -04:00
parent ce703e1b2e
commit 91b2ec5013

View File

@@ -1335,7 +1335,11 @@ bool target_vif_config_del(const struct schema_Wifi_VIF_Config *vconf)
if (strcmp(s->type, "wifi-iface")) continue;
ifname = uci_lookup_option_string( vif_ctx, s, "ifname" );
if (!strcmp(ifname,vconf->if_name)) {
if (ifname == NULL) {
/* Delete this section because it doesn't have an ifname - it is invalid */
uci_section_del(vif_ctx, "vif", "wireless", (char *)s->e.name, "wifi-iface");
} else if (!strcmp(ifname,vconf->if_name)) {
/* Delete this section because it matches the if_name we are trying to delete */
uci_section_del(vif_ctx, "vif", "wireless", (char *)s->e.name, "wifi-iface");
break;
}