Skip to content

Commit

Permalink
Merge pull request #222 from jainvikas8/zeroize-check
Browse files Browse the repository at this point in the history
Check for zero length and NULL buffer pointer.
  • Loading branch information
Patater authored Sep 5, 2019
2 parents c12cb52 + 52fa174 commit 595643c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library/platform_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down

0 comments on commit 595643c

Please sign in to comment.