Merge remote-tracking branch 'origin/pr/2793' into mbedtls-2.16

* origin/pr/2793:
  Changelog entry
  Check for zero length and NULL buffer pointer
This commit is contained in:
Jaeden Amero 2019-09-05 15:57:34 +01:00
commit 71db1de226
2 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,8 @@ Bugfix
* Improve code clarity in x509_crt module, removing false-positive
uninitialized variable warnings on some recent toolchains (GCC8, etc).
Discovered and fixed by Andy Gross (Linaro), #2392.
* Zero length buffer check for undefined behavior in
mbedtls_platform_zeroize(). Fixes ARMmbed/mbed-crypto#49.
Changes
* Make it easier to define MBEDTLS_PARAM_FAILED as assert (which config.h

View File

@ -72,7 +72,10 @@ static void * (* const volatile memset_func)( void *, int, size_t ) = memset;
void mbedtls_platform_zeroize( void *buf, size_t len )
{
memset_func( buf, 0, len );
MBEDTLS_INTERNAL_VALIDATE( len == 0 || buf != NULL );
if( len > 0 )
memset_func( buf, 0, len );
}
#endif /* MBEDTLS_PLATFORM_ZEROIZE_ALT */