mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Add explicit terminator in persistBoardInformation
This commit is contained in:
parent
e32fab2dcb
commit
1dce8dfe28
1 changed files with 4 additions and 0 deletions
|
@ -90,6 +90,7 @@ bool setManufacturerId(const char *newManufacturerId)
|
||||||
if (!boardInformationSet || strlen(manufacturerId) == 0) {
|
if (!boardInformationSet || strlen(manufacturerId) == 0) {
|
||||||
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
||||||
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
|
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
|
||||||
|
|
||||||
boardInformationWasUpdated = true;
|
boardInformationWasUpdated = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -108,6 +109,7 @@ bool setBoardName(const char *newBoardName)
|
||||||
if (!boardInformationSet || strlen(boardName) == 0) {
|
if (!boardInformationSet || strlen(boardName) == 0) {
|
||||||
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH);
|
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH);
|
||||||
boardName[MAX_BOARD_NAME_LENGTH] = 0;
|
boardName[MAX_BOARD_NAME_LENGTH] = 0;
|
||||||
|
|
||||||
boardInformationWasUpdated = true;
|
boardInformationWasUpdated = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -125,7 +127,9 @@ bool persistBoardInformation(void)
|
||||||
#if !defined(BOARD_NAME)
|
#if !defined(BOARD_NAME)
|
||||||
if (boardInformationWasUpdated) {
|
if (boardInformationWasUpdated) {
|
||||||
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
||||||
|
boardConfigMutable()->manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
|
||||||
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH);
|
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH);
|
||||||
|
boardConfigMutable()->boardName[MAX_BOARD_NAME_LENGTH] = 0;
|
||||||
boardConfigMutable()->boardInformationSet = true;
|
boardConfigMutable()->boardInformationSet = true;
|
||||||
|
|
||||||
initBoardInformation();
|
initBoardInformation();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue