Fix null dereferencing and unchecked return value 60/310960/1 accepted/tizen_unified accepted/tizen_unified_x tizen accepted/tizen/unified/20240513.053354 accepted/tizen/unified/x/20240514.011845
authorJaehyun Kim <jeik01.kim@samsung.com>
Fri, 10 May 2024 08:13:55 +0000 (17:13 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Fri, 10 May 2024 08:13:55 +0000 (17:13 +0900)
Change-Id: I2c847e01661c66cdb76bc474b57b3929c73462e8
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/connection.c
unittest/utc-network-connection.c

index a56230c..8def171 100755 (executable)
@@ -551,7 +551,7 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty
        }
 
        /* Checking Invalid MAC Address */
-       if ((strcmp(*mac_addr, "00:00:00:00:00:00") == 0) ||
+       if (*mac_addr == NULL || (strcmp(*mac_addr, "00:00:00:00:00:00") == 0) ||
                        (strcmp(*mac_addr, "ff:ff:ff:ff:ff:ff") == 0)) {
                CONNECTION_LOG(CONNECTION_ERROR, "MAC Address(%s) is invalid", *mac_addr); //LCOV_EXCL_LINE
                CONN_UNLOCK; //LCOV_EXCL_LINE
index fd1ae89..2a4748e 100755 (executable)
@@ -2316,8 +2316,9 @@ int utc_connection_open_profile_n(void)
 int utc_connection_reset_profile_p(void)
 {
        if (telephony_supported) {
-               connection_reset_profile(connection, CONNECTION_RESET_DEFAULT_PROFILE,
+               int ret = connection_reset_profile(connection, CONNECTION_RESET_DEFAULT_PROFILE,
                                0, test_connection_reset_profile_callback, NULL);
+               CHECK_RETURN(CALLBACK_RETURN, ret, CONNECTION_ERROR_NONE);
                CHECK_RETURN(CALLBACK_RETURN, g_CallbackRet, CONNECTION_ERROR_NONE);
                test_connection_reset_profile_callback(CONNECTION_ERROR_NONE, NULL);
        } else {