Bignum: remove unnecessary NULL pointer checks
A null pointer dereference, or null pointer plus small offset, is a clean runtime error in most environments. So it's not particularly useful to protect against this. While at it make a null pointer check that is actually necessary more robust. Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
296ea66442
commit
56a10f97ba
3 changed files with 5 additions and 12 deletions
|
@ -227,7 +227,7 @@ int mbedtls_mpi_core_read_be( mbedtls_mpi_uint *X,
|
|||
|
||||
/* Avoid calling `memcpy` with NULL source or destination argument,
|
||||
* even if buflen is 0. */
|
||||
if( buflen != 0 )
|
||||
if( buf != NULL )
|
||||
{
|
||||
Xp = (unsigned char*) X;
|
||||
memcpy( Xp + overhead, buf, buflen );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue