1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 03:20:00 +03:00

Reserve space for null terminator

This commit is contained in:
Mark Haslinghuis 2025-07-06 18:01:54 +02:00
parent c5497d11a9
commit 32f408bb81
2 changed files with 6 additions and 6 deletions

View file

@ -195,10 +195,10 @@ static const void *cmsx_FirmwareInit(displayPort_t *pDisp)
{ {
UNUSED(pDisp); UNUSED(pDisp);
strncpy(manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1); strncpy(manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH);
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0; manufacturerId[MAX_MANUFACTURER_ID_LENGTH - 1] = '\0';
strncpy(boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1); strncpy(boardName, getBoardName(), MAX_BOARD_NAME_LENGTH);
boardName[MAX_BOARD_NAME_LENGTH] = 0; boardName[MAX_BOARD_NAME_LENGTH - 1] = '\0';
return NULL; return NULL;
} }

View file

@ -29,8 +29,8 @@
#if !defined(BOARD_NAME) #if !defined(BOARD_NAME)
static bool boardInformationSet = false; static bool boardInformationSet = false;
static char manufacturerId[MAX_MANUFACTURER_ID_LENGTH]; static char manufacturerId[MAX_MANUFACTURER_ID_LENGTH + 1];
static char boardName[MAX_BOARD_NAME_LENGTH]; static char boardName[MAX_BOARD_NAME_LENGTH + 1];
static bool boardInformationWasUpdated = false; static bool boardInformationWasUpdated = false;
#endif #endif