-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 gcc 10.1 stringop-truncation error #10346
Conversation
As we do not expect the destination of these strncpy calls to be NUL terminated, substitute them with memcpy. Signed-off-by: George Amanakis <gamanakis@gmail.com>
I think you can simplify it further to: /*
* Take a date like 'Mon May 18 15:23:11 2020' and trim off the day
* of the week (first three chars + space).
*/
memcpy(str, ctime_str + 4, 20); |
@tonyhutter I think that would change the format of the date though. |
Codecov Report
@@ Coverage Diff @@
## master #10346 +/- ##
==========================================
+ Coverage 79.24% 79.48% +0.24%
==========================================
Files 390 390
Lines 123336 123336
==========================================
+ Hits 97737 98036 +299
+ Misses 25599 25300 -299
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gamanakis ah you're right, I see what you mean. Approved
As we do not expect the destination of these strncpy calls to be NULL terminated, substitute them with memcpy. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes openzfs#10346 (cherry picked from commit 7cd723e)
As we do not expect the destination of these strncpy calls to be NULL terminated, substitute them with memcpy. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes openzfs#10346 (cherry picked from commit 7cd723e)
As we do not expect the destination of these strncpy calls to be NULL terminated, substitute them with memcpy. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes openzfs#10346
As we do not expect the destination of these strncpy calls to be NULL terminated, substitute them with memcpy. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes openzfs#10346
As we do not expect the destination of these strncpy calls to be NULL terminated, substitute them with memcpy. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes openzfs#10346
Compiling with gcc 10.1 fails with:
As we do not expect the destination of these
strncpy
calls to be NUL terminated, substitute them withmemcpy
perhttps://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation
Signed-off-by: George Amanakis gamanakis@gmail.com
Motivation and Context
Description
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by
.