Skip to content

Commit

Permalink
Check for zero length and NULL buffer pointer.
Browse files Browse the repository at this point in the history
In reference to issue #49
  • Loading branch information
jainvikas8 committed Sep 4, 2019
1 parent 0ed1df6 commit 52fa174
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 52fa174

Please sign in to comment.