Skip to content

Fix #63, clean up strncpy calls#65

Merged
dzbaker merged 1 commit intonasa:mainfrom
jphickey:fix-63-fm-strncpy
Nov 17, 2022
Merged

Fix #63, clean up strncpy calls#65
dzbaker merged 1 commit intonasa:mainfrom
jphickey:fix-63-fm-strncpy

Conversation

@jphickey
Copy link
Contributor

Checklist (Please check before submitting)

Describe the contribution
Call "strncpy" with the size parameter indicating the size of the destination buffer, rather than the input string length.

A buffer overflow was avoided due to a length check already in the code, but calling the function properly should avoid a warning.

Fixes #63

Testing performed
Build and run all tests
Send the FM_GET_DIR_FILE_CC and FM_GET_DIR_PKT_CC and confirm correct behavior.

Expected behavior changes
No compiler warnings.
No change to functionality.

System(s) tested on
Ubuntu 22.04

Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.

Call "strncpy" with the size parameter indicating the size of the
destination buffer, rather than the input string length.

A buffer overflow was avoided due to a length check already in the code,
but calling the function properly should avoid a warning.
@jphickey
Copy link
Contributor Author

Note - "Build and Run" workflow is now passing, log here: https://github.com/nasa/FM/actions/runs/3463996146

Other errors remain but those will be fixed by separate PRs.

@dzbaker dzbaker merged commit c4063cc into nasa:main Nov 17, 2022
@dmknutsen dmknutsen added this to the Draco milestone Jan 18, 2023
@jphickey jphickey deleted the fix-63-fm-strncpy branch March 7, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New GCC warnings causing build failure [-Werror=stringop-overflow=]

3 participants