From b6372f99bad285db1e0589e770774a9955f35adf Mon Sep 17 00:00:00 2001 From: Rajeev Katta Date: Fri, 5 Dec 2025 15:57:53 -0500 Subject: [PATCH] wifi_ctrl_webconfig: fix null pointer dereference in webconfig_vif_neighbors_apply The webconfig_vif_neighbors_apply function was dereferencing the data parameter before checking if it was NULL, which could lead to segmentation faults. This commit adds a null check at the beginning of the function and returns RETURN_ERR if the pointer is NULL. Changes: - Add null check for data parameter at function start - Return RETURN_ERR with error logging if NULL - Remove redundant null check in cleanup section --- source/core/wifi_ctrl_webconfig.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/core/wifi_ctrl_webconfig.c b/source/core/wifi_ctrl_webconfig.c index 573b1c406..10696409f 100644 --- a/source/core/wifi_ctrl_webconfig.c +++ b/source/core/wifi_ctrl_webconfig.c @@ -1262,6 +1262,11 @@ int webconfig_vif_neighbors_apply(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_da wifi_util_dbg_print(WIFI_MGR,"%s %d \n", __func__, __LINE__); + if (data == NULL) { + wifi_util_error_print(WIFI_MGR,"%s:%d data is NULL\n", __func__, __LINE__); + return RETURN_ERR; + } + mgr_cfg_map = mgr->vif_neighbors_map; dec_cfg_map = data->vif_neighbors_map; @@ -1319,7 +1324,7 @@ int webconfig_vif_neighbors_apply(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_da } } free_data: - if ((data != NULL) && (dec_cfg_map != NULL)) { + if (dec_cfg_map != NULL) { wifi_util_dbg_print(WIFI_MGR,"%s %d Freeing Decoded Data \n", __func__, __LINE__); dec_vif_neighbors = hash_map_get_first(dec_cfg_map); while (dec_vif_neighbors != NULL) {