Skip to content

Handle strncpy in a way compatible with gcc-9 linting#9

Merged
jamesodhunt merged 1 commit intojamesodhunt:masterfrom
vorlonofportland:master
Aug 1, 2019
Merged

Handle strncpy in a way compatible with gcc-9 linting#9
jamesodhunt merged 1 commit intojamesodhunt:masterfrom
vorlonofportland:master

Conversation

@vorlonofportland
Copy link
Copy Markdown
Contributor

gcc-9 is now more rigorous about ensuring strncpy() is used correctly and
errors out if the bound argument appears to be derived from the source
argument:
/usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
Leverage this compiler functionality, and in the process fix a possible
1-byte buffer overflow.

gcc-9 is now more rigorous about ensuring strncpy() is used correctly and
errors out if the bound argument appears to be derived from the source
argument:
/usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
Leverage this compiler functionality, and in the process fix a possible
1-byte buffer overflow.
@vorlonofportland vorlonofportland mentioned this pull request Jul 20, 2019
@jamesodhunt
Copy link
Copy Markdown
Owner

Thanks @vorlonofportland - hope all well with you! 😉

@jamesodhunt jamesodhunt merged commit b34e722 into jamesodhunt:master Aug 1, 2019
@xnox
Copy link
Copy Markdown

xnox commented Aug 5, 2019

07:33:16 | <juliank> | He fixed the -O2 case
07:33:26 | <juliank> | But it still fails on ppc64el as it uses -O3

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.

3 participants