From 6e51b9c4fbc14038218678a041962568a3a217a8 Mon Sep 17 00:00:00 2001 From: Maneesh Jain Date: Sun, 7 Feb 2016 12:51:33 -0500 Subject: [PATCH] [wfd-plugin]: Add NULL check to avoid potential crash. Description: This patch adds validation check in following function. 1. ws_create_group() Change-Id: Iaa1077ad04e6ae547ab62b53744760a8142eb55f Signed-off-by: Maneesh Jain --- .../ctrl_iface_dbus/wfd-plugin-wpasupplicant.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c index aaea069..da845b1 100755 --- a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c +++ b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c @@ -3167,17 +3167,20 @@ int ws_prov_disc_req(unsigned char *peer_addr, wfd_oem_wps_mode_e wps_mode, int if (!peer_addr) { WDP_LOGE("Invalid parameter"); + __WDP_LOG_FUNC_EXIT__; return -1; } if (!g_pd) { WDP_LOGE("ws_dbus_plugin_data_s is not created yet"); + __WDP_LOG_FUNC_EXIT__; return -1; } g_dbus = g_pd->g_dbus; if (!g_dbus) { WDP_LOGE("DBus connection is NULL"); + __WDP_LOG_FUNC_EXIT__; return -1; } memset(¶ms, 0x0, sizeof(dbus_method_param_s)); @@ -3217,17 +3220,20 @@ int ws_connect(unsigned char *peer_addr, wfd_oem_conn_param_s *param) if (!peer_addr || !param) { WDP_LOGE("Invalid parameter"); + __WDP_LOG_FUNC_EXIT__; return -1; } if (!g_pd) { WDP_LOGE("ws_dbus_plugin_data_s is not created yet"); + __WDP_LOG_FUNC_EXIT__; return -1; } g_dbus = g_pd->g_dbus; if (!g_dbus) { WDP_LOGE("DBus connection is NULL"); + __WDP_LOG_FUNC_EXIT__; return -1; } memset(¶ms, 0x0, sizeof(dbus_method_param_s)); @@ -3488,14 +3494,22 @@ int ws_create_group(wfd_oem_group_param_s *param) char persistent_group_obj_path[OBJECT_PATH_MAX] = {0,}; int res = 0; + if (!param) { + WDP_LOGE("Invalid parameter"); + __WDP_LOG_FUNC_EXIT__; + return -1; + } + if (!g_pd) { WDP_LOGE("ws_dbus_plugin_data_s is not created yet"); + __WDP_LOG_FUNC_EXIT__; return -1; } g_dbus = g_pd->g_dbus; if (!g_dbus) { WDP_LOGE("DBus connection is NULL"); + __WDP_LOG_FUNC_EXIT__; return -1; } memset(¶ms, 0x0, sizeof(dbus_method_param_s)); -- 2.7.4