mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Merge pull request #247 from kaleb-himes/null-pointer-excptn
safeguards to avoid de-referencing a null pointer
This commit is contained in:
@@ -125,6 +125,10 @@ int mp_init (mp_int * a)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Safeguard against passing in a null pointer */
|
||||
if (a == NULL)
|
||||
return MP_VAL;
|
||||
|
||||
/* allocate memory required and clear it */
|
||||
a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC, 0,
|
||||
DYNAMIC_TYPE_BIGINT);
|
||||
@@ -275,6 +279,10 @@ mp_copy (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res, n;
|
||||
|
||||
/* Safeguard against passing in a null pointer */
|
||||
if (a == NULL || b == NULL)
|
||||
return MP_VAL;
|
||||
|
||||
/* if dst == src do nothing */
|
||||
if (a == b) {
|
||||
return MP_OKAY;
|
||||
|
Reference in New Issue
Block a user