Skip to content

Commit 5559827

Browse files
committed
Fix out of bounds buffer access
1 parent 61d60a3 commit 5559827

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

components/bl602/bl602_wifidrv/bl60x_wifi_driver/wifi_mgmr_profile.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ int wifi_mgmr_profile_add(wifi_mgmr_t *mgmr, wifi_mgmr_profile_msg_t *profile_ms
4848
for (i = 0; i < sizeof(mgmr->profiles)/sizeof(mgmr->profiles[0]); i++) {
4949
if (0 == mgmr->profiles[i].isUsed) {
5050
profile = &(mgmr->profiles[i]);
51-
51+
5252
mgmr->profile_active_index = i;
5353
os_printf("[WF][PF] Using free profile, idx is @%d\r\n", i);
5454
break;
@@ -65,10 +65,10 @@ int wifi_mgmr_profile_add(wifi_mgmr_t *mgmr, wifi_mgmr_profile_msg_t *profile_ms
6565
profile->psk_len = profile_msg->psk_len;
6666
profile->pmk_len = profile_msg->pmk_len;
6767
profile->priority = 255;
68-
memcpy(profile->ssid, profile_msg->ssid, sizeof(profile->ssid));
69-
memcpy(profile->psk, profile_msg->psk, sizeof(profile->psk));
70-
memcpy(profile->pmk, profile_msg->pmk, sizeof(profile->pmk));
71-
memcpy(profile->mac, profile_msg->mac, sizeof(profile->mac));
68+
memcpy(profile->ssid, profile_msg->ssid, sizeof(profile_msg->ssid));
69+
memcpy(profile->psk, profile_msg->psk, sizeof(profile_msg->psk));
70+
memcpy(profile->pmk, profile_msg->pmk, sizeof(profile_msg->pmk));
71+
memcpy(profile->mac, profile_msg->mac, sizeof(profile_msg->mac));
7272
profile->dhcp_use = profile_msg->dhcp_use;
7373

7474
return 0;
@@ -122,10 +122,10 @@ int wifi_mgmr_profile_get(wifi_mgmr_t *mgmr, wifi_mgmr_profile_msg_t *profile_ms
122122
profile_msg->psk_len = profile->psk_len;
123123
profile_msg->pmk_len = profile->pmk_len;
124124
profile_msg->dhcp_use = profile->dhcp_use;
125-
memcpy(profile_msg->ssid, profile->ssid, sizeof(profile->ssid));
126-
memcpy(profile_msg->psk, profile->psk, sizeof(profile->psk));
127-
memcpy(profile_msg->pmk, profile->pmk, sizeof(profile->pmk));
128-
memcpy(profile_msg->mac, profile->mac, sizeof(profile->mac));
125+
memcpy(profile_msg->ssid, profile->ssid, sizeof(profile_msg->ssid));
126+
memcpy(profile_msg->psk, profile->psk, sizeof(profile_msg->psk));
127+
memcpy(profile_msg->pmk, profile->pmk, sizeof(profile_msg->pmk));
128+
memcpy(profile_msg->mac, profile->mac, sizeof(profile_msg->mac));
129129

130130
return 0;
131131
}
@@ -149,7 +149,7 @@ int wifi_mgmr_profile_autoreconnect_is_enabled(wifi_mgmr_t *mgmr, int index)
149149
{
150150
#if 0
151151
wifi_mgmr_profile_t *profile;
152-
152+
153153
profile = __lookup_profile(mgmr, index);
154154
if (NULL == profile) {
155155
return -1;

0 commit comments

Comments
 (0)