From: Seonah Moon Date: Fri, 3 Apr 2020 04:31:50 +0000 (+0900) Subject: Fix coverity isseus: BUFFER_SIZE X-Git-Tag: submit/tizen/20200403.050222~1^2^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc5e83a794adf356e6e60e4819c7ce32a80914ce;p=platform%2Fcore%2Fapi%2Fwifi-aware.git Fix coverity isseus: BUFFER_SIZE --- diff --git a/test/wifi-aware-publish-test.c b/test/wifi-aware-publish-test.c index 2d31b20..6282269 100644 --- a/test/wifi-aware-publish-test.c +++ b/test/wifi-aware-publish-test.c @@ -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"); diff --git a/test/wifi-aware-subscribe-test.c b/test/wifi-aware-subscribe-test.c index df25e4c..6499182 100644 --- a/test/wifi-aware-subscribe-test.c +++ b/test/wifi-aware-subscribe-test.c @@ -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(); }