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:
Eric Katzfey 2026-01-29 13:02:36 -08:00 committed by GitHub
parent 03264ce1a7
commit 90fec17427
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}