Fix realloc usage in ec_curve.c
Submitted by: Nils Larsch Reviewed by: Geoff Thorpe
This commit is contained in:
parent
d5f686d808
commit
ca982e4870
@ -1226,16 +1226,17 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out)
|
|||||||
a->conv_form, NULL, 0, NULL);
|
a->conv_form, NULL, 0, NULL);
|
||||||
|
|
||||||
if (tmp_len > buf_len)
|
if (tmp_len > buf_len)
|
||||||
buffer = OPENSSL_realloc(buffer, tmp_len);
|
|
||||||
if (buffer == NULL)
|
|
||||||
{
|
{
|
||||||
ECerr(EC_F_I2D_ECPRIVATEKEY,
|
unsigned char *tmp_buffer = OPENSSL_realloc(buffer, tmp_len);
|
||||||
ERR_R_MALLOC_FAILURE);
|
if (!tmp_buffer)
|
||||||
goto err;
|
{
|
||||||
|
ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
buffer = tmp_buffer;
|
||||||
|
buf_len = tmp_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf_len = tmp_len;
|
|
||||||
|
|
||||||
if (!EC_POINT_point2oct(a->group, a->pub_key,
|
if (!EC_POINT_point2oct(a->group, a->pub_key,
|
||||||
a->conv_form, buffer, buf_len, NULL))
|
a->conv_form, buffer, buf_len, NULL))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user