i#7274: Warn on possible strncpy truncation in func_trace.cpp#7267
Conversation
2f62c53 to
e02be10
Compare
|
Sorry for force push, I had the wrong git config on the commit, adding someone else to this PR on accident... |
|
This is also technically a performance improvement. The above patch avoids always writing |
There was a problem hiding this comment.
Thank you for contributing!
We usually start by filing an issue.
I have done it for you in this case: #7274.
Please add answers to the following questions in that issue:
- What version of DynamoRIO are you using?
- Does the latest build from https://github.com/DynamoRIO/dynamorio/releases solve the problem?
- What operating system version are you running on? ("Windows 10" is not sufficient: give the release number.)
- Is your application 32-bit or 64-bit?
And add a snippet of the errors during build.
Please edit your PR description to remove the redundant information now in #7274 and only describe your code changes and their effect.
Also, please change the PR title adding the issue number first:
i#7274: Fix strncpy truncation error from gcc stringop-truncations
You also don't need to create multiple single-commit PRs (#7268 #7269).
Since all those changes are related to #7274 you can put them in a single PR, just add-commit-push to the same branch.
And, as you noted, please avoid force-push.
|
Even though no one has asked for it, my take on this is that blanket use of Since this 'copy a string and trust that statements afterwards ensure it is safe for use' is spread around the code base, my opinion is that it would improve security and efficiency to have a string datatype in DynamoRIO with one designed |
Most string operations in DR involve constructing a multi-part string via snprintf, not just a copy, though, IIRC. To your point, it does seem likely that none of the uses of |
Grepping for |
Up to you if you'd like to add more changes to this PR or to do it in another. Am I understanding correctly that the stringop-truncation errors disappeared after fixing your build dir? If that's the case, don't forget to update your PR description, which still mentions them. |
|
Addressed above review comments |
derekbruening
left a comment
There was a problem hiding this comment.
Thank you for working through all the iterations on this PR and contributing to the project.
We're happy to take further improvements! Thank you for volunteering. Echoing @edeiana: I could see it either way: all instances of avoiding strncpy excessive writes in one PR seems reasonable. |
edeiana
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
Issue #7274
Warn on possible strncpy truncation in func_trace.cpp, avoid null byte copies