Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compiler warnings - board.c - strncpy, allow trailing null (5th character) #974

Merged

Conversation

nerdCopter
Copy link
Member

@nerdCopter nerdCopter commented Feb 23, 2024

  • board.c strncpy allow trailing null (5th character)
  • confirmed this is how Betaflight does it too
  • fixes:
./src/main/pg/board.c:47:9: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
   47 |         strncpy(boardConfig->manufacturerId, TARGET_MANUFACTURER_IDENTIFIER, MAX_MANUFACTURER_ID_LENGTH);

@nerdCopter nerdCopter marked this pull request as ready for review March 1, 2024 14:09
@nerdCopter
Copy link
Member Author

tested several FC found zero ill-effects.

@nerdCopter nerdCopter merged commit f5c35c6 into emuflight:master Mar 1, 2024
6 checks passed
@nerdCopter nerdCopter deleted the 20240223_fix_compile_warnings_strncpy branch March 1, 2024 14:09
@nerdCopter nerdCopter restored the 20240223_fix_compile_warnings_strncpy branch June 26, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant