-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Backport 2.7: Check for zero length and NULL buffer pointer #2794
Backport 2.7: Check for zero length and NULL buffer pointer #2794
Conversation
Some trailing whitespace snuck in. Please remove. |
e24d969
to
d64ae2c
Compare
Force-pushed to remove trailing whitespaces. |
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.
LGTM
Demoting from ready to merge state as we may want to resolve ARMmbed/mbed-crypto#222 (comment) first |
In reference to issue ARMmbed/mbed-crypto#49
2b340ed
d64ae2c
to
2b340ed
Compare
Forced push to accommodate reviewer change request from ARMmbed/mbed-crypto#222 (comment). |
2b340ed
to
a2fb154
Compare
Forced push to changelog. |
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0; | ||
static void mbedtls_zeroize( void *v, size_t n ) | ||
{ | ||
if( n > 0 ) |
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.
Unlike the other implementations of zeroize that call memset
, we probably don't need this if
here as there is no undefined behavior. If n is 0, the loop is not executed. The local volatile pointer assignment won't do anything meaningful, since we don't use p
at all when n is 0.
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.
There's no bug to fix in 2.7, is there?
Yes, there is no bug to fix. Referred few functions and the NULL pointer is checked before the call. So no need to check for length. Therefore closing it. |
In reference to issue ARMmbed/mbed-crypto#49
Backport of ARMmbed/mbed-crypto#222