lib/hcrypto: mpz2BN unsafe to call mp_to_ubin with NULL
remove the (size != 0) exception to malloc() failure. Change-Id: I7a678b0fadd51c673491b61c06afd4203c871318
This commit is contained in:
@@ -67,7 +67,7 @@ mpz2BN(mp_int *s)
|
|||||||
|
|
||||||
size = mp_ubin_size(s);
|
size = mp_ubin_size(s);
|
||||||
p = malloc(size);
|
p = malloc(size);
|
||||||
if (p == NULL && size != 0)
|
if (p == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (mp_to_ubin(s, p, SIZE_MAX, NULL) != MP_OKAY) {
|
if (mp_to_ubin(s, p, SIZE_MAX, NULL) != MP_OKAY) {
|
||||||
free(p);
|
free(p);
|
||||||
|
Reference in New Issue
Block a user