mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
CRSF_RC: Replace strlcpy with strncpy and null termination. strlcpy is a BSD extension and is not part of standard C/C++. (#26381)
It's typically not available in glibc's <string.h>.
This commit is contained in:
parent
03264ce1a7
commit
90fec17427
@ -264,7 +264,8 @@ static bool ProcessElrsStatus(const uint8_t *data, const uint32_t size, CrsfPack
|
||||
new_packet->elrs_status.packets_bad = data[2];
|
||||
new_packet->elrs_status.packets_good = (data[3] << 8) | data[4];
|
||||
new_packet->elrs_status.flags = data[5];
|
||||
strlcpy(new_packet->elrs_status.message, (const char *)&data[6], sizeof(new_packet->elrs_status.message));
|
||||
strncpy(new_packet->elrs_status.message, (const char *)&data[6], sizeof(new_packet->elrs_status.message) - 1);
|
||||
new_packet->elrs_status.message[sizeof(new_packet->elrs_status.message) - 1] = '\0';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user