1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00

Add explicit terminator in persistBoardInformation

This commit is contained in:
Mark Haslinghuis 2025-07-06 18:37:37 +02:00
parent e32fab2dcb
commit 1dce8dfe28

View file

@ -90,6 +90,7 @@ bool setManufacturerId(const char *newManufacturerId)
if (!boardInformationSet || strlen(manufacturerId) == 0) {
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH);
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
boardInformationWasUpdated = true;
return true;
@ -108,6 +109,7 @@ bool setBoardName(const char *newBoardName)
if (!boardInformationSet || strlen(boardName) == 0) {
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH);
boardName[MAX_BOARD_NAME_LENGTH] = 0;
boardInformationWasUpdated = true;
return true;
@ -125,7 +127,9 @@ bool persistBoardInformation(void)
#if !defined(BOARD_NAME)
if (boardInformationWasUpdated) {
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
boardConfigMutable()->manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH);
boardConfigMutable()->boardName[MAX_BOARD_NAME_LENGTH] = 0;
boardConfigMutable()->boardInformationSet = true;
initBoardInformation();