Fix coverity isseus: BUFFER_SIZE
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 3 Apr 2020 04:31:50 +0000 (13:31 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Fri, 3 Apr 2020 04:31:50 +0000 (13:31 +0900)
test/wifi-aware-publish-test.c
test/wifi-aware-subscribe-test.c

index 2d31b200868396f0c751fa3ee1a09d9d0c7c5f24..62822699090ae81de56bfbe1d2426ea40179b46c 100644 (file)
@@ -321,7 +321,7 @@ static void __open_data_path(wifi_aware_session_h session)
                break;
        case WIFI_AWARE_SECURITY_TYPE_PSK:
                printf("PSK\n");
-               ret = wifi_aware_data_path_set_psk(g_ndp, PSK);
+               wifi_aware_data_path_set_psk(g_ndp, PSK);
                break;
        case WIFI_AWARE_SECURITY_TYPE_PMK:
                printf("PMK\n");
index df25e4c539e6c9a25a641f3858418d7d10eaab85..6499182d6040ea20b6966ac899a01cdee27250aa 100644 (file)
@@ -545,7 +545,8 @@ void test_psk_passive()
        clear_resources();
        g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE;
        g_security_type = WIFI_AWARE_SECURITY_TYPE_PSK;
-       strncpy(g_psk, PSK, strlen(PSK));
+       strncpy(g_psk, PSK, MAX_PSK_LEN);
+       g_psk[MAX_PSK_LEN] = '\0';
        run_common();
 }
 
@@ -554,7 +555,8 @@ void test_psk_active()
        clear_resources();
        g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_ACTIVE;
        g_security_type = WIFI_AWARE_SECURITY_TYPE_PSK;
-       strncpy(g_psk, PSK, strlen(PSK));
+       strncpy(g_psk, PSK, MAX_PSK_LEN);
+       g_psk[MAX_PSK_LEN] = '\0';
        run_common();
 }
 
@@ -563,7 +565,8 @@ void test_psk_passive2()
        clear_resources();
        g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE;
        g_security_type = WIFI_AWARE_SECURITY_TYPE_PSK;
-       strncpy(g_psk, WRONG_PSK, strlen(WRONG_PSK));
+       strncpy(g_psk, WRONG_PSK, MAX_PSK_LEN);
+       g_psk[MAX_PSK_LEN] = '\0';
        run_common();
 }
 
@@ -572,7 +575,8 @@ void test_psk_active2()
        clear_resources();
        g_sub_type = WIFI_AWARE_SUBSCRIBE_TYPE_ACTIVE;
        g_security_type = WIFI_AWARE_SECURITY_TYPE_PSK;
-       strncpy(g_psk, WRONG_PSK, strlen(WRONG_PSK));
+       strncpy(g_psk, WRONG_PSK, MAX_PSK_LEN);
+       g_psk[MAX_PSK_LEN] = '\0';
        run_common();
 }