Skip to content

Commit

Permalink
drivers: wifi: esp_at: use memcpy() to copy SSID
Browse files Browse the repository at this point in the history
Target SSID buffer might not be NULL terminated, so use memcpy() instead of
strncpy() for copying it from temporary (AT response fragment) buffer.

Signed-off-by: Marcin Niestroj <[email protected]>
  • Loading branch information
mniestroj authored and aescolar committed Jul 5, 2024
1 parent f15c4e3 commit 4150765
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/wifi/esp_at/esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ MODEM_CMD_DIRECT_DEFINE(on_cmd_cwlap)
return -EBADMSG;
}

strncpy(res.ssid, ssid, sizeof(res.ssid));
res.ssid_length = MIN(sizeof(res.ssid), strlen(ssid));
memcpy(res.ssid, ssid, res.ssid_length);

res.rssi = strtol(rssi, NULL, 10);

Expand Down

0 comments on commit 4150765

Please sign in to comment.