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 #1173, separate append on volume_name to system_mountpt #1355

Merged
merged 1 commit into from
Jan 26, 2023

Conversation

jphickey
Copy link
Contributor

Checklist (Please check before submitting)

Describe the contribution
Generating the system_mountpt string via a single call to snprintf triggered a compiler warning about overlapping memory. However this does not seem like a real warning, as the volume_name should always be null terminated before the overlap would be possible.

By separating this to be a separate append of the volume_name along with an explicit size check to ensure the buffers indeed do not overlap, this avoids the warning.

Fixes #1173

Testing performed
Build and run all tests

Expected behavior changes
Avoids a false compiler warning about possible pointer overlap by explicitly checking and limiting the string length being appended.

No functional change, as the generated "system_mountpt" string should be identical.

System(s) tested on
Debian

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

Generating the system_mountpt string via a single call to snprintf
triggered a compiler warning about overlapping memory.  However this
does not seem like a real warning, as the volume_name should always
be null terminated before the overlap would be possible.

By separating this to be a separate append of the volume_name along with
an explicit size check to ensure the buffers indeed do not overlap, this
avoids the warning.
@jphickey jphickey added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Jan 23, 2023
@dzbaker dzbaker added CCB:Approved Indicates code review and approval by community CCB and removed CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) labels Jan 26, 2023
dzbaker added a commit to nasa/cFS that referenced this pull request Jan 26, 2023
*Combines:*

osal v6.0.0-rc4+dev184

**Includes:**

*osal*
- nasa/osal#1355

Co-authored by: Joseph Hickey <[email protected]>
@dzbaker dzbaker merged commit 963d357 into nasa:main Jan 26, 2023
dzbaker added a commit to nasa/cFS that referenced this pull request Jan 26, 2023
*Combines:*

osal v6.0.0-rc4+dev184

**Includes:**

*osal*
- nasa/osal#1355

Co-authored by: Joseph Hickey <[email protected]>
@jphickey jphickey deleted the fix-1173-mountpt-string-append branch February 3, 2023 15:15
@dmknutsen dmknutsen added this to the Draco milestone Feb 6, 2023
@dmknutsen dmknutsen modified the milestones: Draco, Equuleus May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB Equuleus-rc1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy of Overlapping Memory in snprintf
3 participants