Skip to content

Commit

Permalink
fix compiler warnings - board.c - strncpy, allow trailing null (5th c…
Browse files Browse the repository at this point in the history
…haracter) (#974)
  • Loading branch information
nerdCopter authored Mar 1, 2024
1 parent 2284366 commit f5c35c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/pg/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ PG_REGISTER_WITH_RESET_FN(boardConfig_t, boardConfig, PG_BOARD_CONFIG, 0);

void pgResetFn_boardConfig(boardConfig_t *boardConfig) {
if (boardInformationIsSet()) {
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH);
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH);
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1);
boardConfig->boardInformationSet = true;
} else {
#if !defined(GENERIC_TARGET)
strncpy(boardConfig->boardName, targetName, MAX_BOARD_NAME_LENGTH);
strncpy(boardConfig->boardName, targetName, MAX_BOARD_NAME_LENGTH + 1);
#if defined(TARGET_MANUFACTURER_IDENTIFIER)
strncpy(boardConfig->manufacturerId, TARGET_MANUFACTURER_IDENTIFIER, MAX_MANUFACTURER_ID_LENGTH);
strncpy(boardConfig->manufacturerId, TARGET_MANUFACTURER_IDENTIFIER, MAX_MANUFACTURER_ID_LENGTH + 1);
#endif
boardConfig->boardInformationSet = true;
#else
Expand Down

0 comments on commit f5c35c6

Please sign in to comment.