Merge pull request #222 from jainvikas8/zeroize-check

Check for zero length and NULL buffer pointer.
This commit is contained in:
Jaeden Amero 2019-09-05 17:35:40 +01:00 committed by GitHub
commit 595643c514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 */