Added NULL pointer guard check before 41/151341/4
authorAbhishek Chandra <abhishek.ch@samsung.com>
Wed, 20 Sep 2017 12:29:23 +0000 (17:59 +0530)
committerAbhishek Chandra <abhishek.ch@samsung.com>
Thu, 21 Sep 2017 04:49:02 +0000 (10:19 +0530)
g_ascii_strcasecmp.

Change-Id: Iec3f82a5b6d9dec394b4cdcfd34e09693efec36e
Signed-off-by: Abhishek Chandra <abhishek.ch@samsung.com>
bt-api/bt-common.c
bt-service/bt-service-network.c

index d3de84b..af738d5 100644 (file)
@@ -1485,9 +1485,12 @@ int _bt_discover_service_uuids(char *address, char *remote_uuid)
        if (uuid_value) {
                for (i = 0; uuid_value[i] != NULL; i++) {
                        BT_DBG("Remote uuids %s", uuid_value[i]);
-                       if (g_ascii_strcasecmp(uuid_value[i], remote_uuid) == 0) {
-                               result = BLUETOOTH_ERROR_NONE;
-                               goto done;
+                       if (uuid_value[i] == NULL) {
+                               BT_ERR("_bt_discover_service_uuids Error Parameter are NULL..\n");
+                               continue;
+                       } else if (g_ascii_strcasecmp(uuid_value[i], remote_uuid) == 0) {
+                                       result = BLUETOOTH_ERROR_NONE;
+                                       goto done;
                        }
                }
        }
index 00140da..bd065b2 100644 (file)
@@ -100,7 +100,10 @@ static connection_profile_h __bt_get_net_profile(void *connection,
                        if (g_strv_length(split_string) < 3)
                                continue;
 
-                       if (g_ascii_strcasecmp(split_string[2], net_address) == 0) {
+                       if (split_string[2] == NULL) {
+                               BT_ERR("__bt_get_net_profile Error Parameter are NULL..\n");
+                               continue;
+                       } else if (g_ascii_strcasecmp(split_string[2], net_address) == 0) {
                                BT_DBG("matched profile");
                                g_strfreev(split_string);
                                return profile_h;