summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/crypto/asn1/f_int.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssl/crypto/asn1/f_int.c')
-rw-r--r--crypto/openssl/crypto/asn1/f_int.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/openssl/crypto/asn1/f_int.c b/crypto/openssl/crypto/asn1/f_int.c
index 6b090f6..9494e59 100644
--- a/crypto/openssl/crypto/asn1/f_int.c
+++ b/crypto/openssl/crypto/asn1/f_int.c
@@ -69,10 +69,16 @@ int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a)
if (a == NULL) return(0);
+ if (a->type & V_ASN1_NEG)
+ {
+ if (BIO_write(bp, "-", 1) != 1) goto err;
+ n = 1;
+ }
+
if (a->length == 0)
{
if (BIO_write(bp,"00",2) != 2) goto err;
- n=2;
+ n += 2;
}
else
{
@@ -163,8 +169,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
sp=(unsigned char *)OPENSSL_malloc(
(unsigned int)num+i*2);
else
- sp=(unsigned char *)OPENSSL_realloc(s,
- (unsigned int)num+i*2);
+ sp=OPENSSL_realloc_clean(s,slen,num+i*2);
if (sp == NULL)
{
ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
OpenPOWER on IntegriCloud