Skip to content

Commit fa6f80d

Browse files
committed
fix: cloud: Use correct Wi-Fi AP count for location request
The wifi_ap_data_construct function was incorrectly using the size of the destination buffer instead of the actual number of scanned Wi-Fi access points. This caused uninitialized data with invalid MAC addresses to be sent to nRF Cloud, resulting in a location request failure. The fix ensures the correct count of scanned APs is used, preventing invalid data from being sent. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent 5941abc commit fa6f80d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/modules/cloud/cloud_location.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static int wifi_ap_data_construct(struct wifi_scan_info *dest,
111111
}
112112

113113
/* Copy WiFi AP data */
114-
for (uint16_t i = 0; i < ap_info_count; i++) {
114+
for (uint16_t i = 0; i < src->wifi_cnt; i++) {
115115
ap_info[i].rssi = src->wifi_aps[i].rssi;
116116
memcpy(ap_info[i].mac,
117117
src->wifi_aps[i].mac,
@@ -120,7 +120,7 @@ static int wifi_ap_data_construct(struct wifi_scan_info *dest,
120120
}
121121

122122
dest->ap_info = ap_info;
123-
dest->cnt = ap_info_count;
123+
dest->cnt = src->wifi_cnt;
124124

125125
return 0;
126126
}

0 commit comments

Comments
 (0)