From 9a776f6f318752b57cb5a6a1c5ec4d39f327b92a Mon Sep 17 00:00:00 2001 From: Rajeev Katta Date: Fri, 5 Dec 2025 15:57:47 -0500 Subject: [PATCH] wifi_ctrl_webconfig: fix null pointer dereference in webconfig_steering_config_apply The webconfig_steering_config_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..69f36f13c 100644 --- a/source/core/wifi_ctrl_webconfig.c +++ b/source/core/wifi_ctrl_webconfig.c @@ -1175,6 +1175,11 @@ int webconfig_steering_config_apply(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_ 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->steering_config_map; dec_cfg_map = data->steering_config_map; @@ -1232,7 +1237,7 @@ int webconfig_steering_config_apply(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_ } } 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_steer_config = hash_map_get_first(dec_cfg_map); while (dec_steer_config != NULL) {