Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
uGnssInfoGetVersions: do not crash if partial version data
Browse files Browse the repository at this point in the history
Signed-off-by: Alon Bar-Lev <[email protected]>
  • Loading branch information
alonbl committed Nov 4, 2023
1 parent 6123978 commit 1407cb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gnss/src/u_gnss_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int32_t uGnssInfoGetVersions(uDeviceHandle_t gnssHandle,
memset(pVer, 0, sizeof(*pVer));
strncpy(pVer->ver, message.sw, sizeof(pVer->ver));
strncpy(pVer->hw, message.hw, sizeof(pVer->hw));
size_t n = (errorCodeOrLength - sizeof(message.sw) + sizeof(message.hw)) / sizeof(message.ext[0]);
size_t n = (errorCodeOrLength - (sizeof(message.sw) + sizeof(message.hw))) / sizeof(message.ext[0]);
for (size_t i = 0; i < n; i++) {
if (0 == strncmp(message.ext[i], "ROM BASE ", 9)) {
strncpy(pVer->rom, message.ext[i] + 9, sizeof(pVer->rom));
Expand Down

0 comments on commit 1407cb6

Please sign in to comment.