diff options
author | Geoff Thorpe <geoff@openssl.org> | 2004-05-04 22:08:55 +0200 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2004-05-04 22:08:55 +0200 |
commit | ca982e48707905f82fa74a6de2eaef46115f949a (patch) | |
tree | 21e0f9b0e7684d8b73c2ce1180b5708cc46c8149 /crypto/ec/ec_asn1.c | |
parent | - update from current 0.9.6-stable CHANGES file (diff) | |
download | openssl-ca982e48707905f82fa74a6de2eaef46115f949a.tar.xz openssl-ca982e48707905f82fa74a6de2eaef46115f949a.zip |
Fix realloc usage in ec_curve.c
Submitted by: Nils Larsch
Reviewed by: Geoff Thorpe
Diffstat (limited to 'crypto/ec/ec_asn1.c')
-rw-r--r-- | crypto/ec/ec_asn1.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c index 6e3a02ab86..bfb6f3c9cc 100644 --- a/crypto/ec/ec_asn1.c +++ b/crypto/ec/ec_asn1.c @@ -1226,16 +1226,17 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) a->conv_form, NULL, 0, NULL); if (tmp_len > buf_len) - buffer = OPENSSL_realloc(buffer, tmp_len); - if (buffer == NULL) { - ECerr(EC_F_I2D_ECPRIVATEKEY, - ERR_R_MALLOC_FAILURE); - goto err; + unsigned char *tmp_buffer = OPENSSL_realloc(buffer, tmp_len); + if (!tmp_buffer) + { + 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, a->conv_form, buffer, buf_len, NULL)) { |