aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_object.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2016-09-22 13:05:59 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2016-09-22 13:05:59 +0000
commit2c14c598c3061ac2533f997352aa06a2266f44d9 (patch)
tree470894a14935f308eeac93c6cbf6cf25632e1cb1 /crypto/asn1/a_object.c
parent47b11f985b9e0ff561a67e19674de6fbcf79281d (diff)
downloadsrc-2c14c598c3061ac2533f997352aa06a2266f44d9.tar.gz
src-2c14c598c3061ac2533f997352aa06a2266f44d9.zip
Notes
Notes: svn path=/vendor-crypto/openssl/dist-1.0.1/; revision=306191 svn path=/vendor-crypto/openssl/1.0.1u/; revision=306192; tag=vendor/openssl/1.0.1u
Diffstat (limited to 'crypto/asn1/a_object.c')
-rw-r--r--crypto/asn1/a_object.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c
index 27f9c1691462..229a40ffa344 100644
--- a/crypto/asn1/a_object.c
+++ b/crypto/asn1/a_object.c
@@ -73,7 +73,7 @@ int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp)
return (0);
objsize = ASN1_object_size(0, a->length, V_ASN1_OBJECT);
- if (pp == NULL)
+ if (pp == NULL || objsize == -1)
return objsize;
p = *pp;
@@ -174,8 +174,12 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
if (!tmp)
goto err;
}
- while (blsize--)
- tmp[i++] = (unsigned char)BN_div_word(bl, 0x80L);
+ while (blsize--) {
+ BN_ULONG t = BN_div_word(bl, 0x80L);
+ if (t == (BN_ULONG)-1)
+ goto err;
+ tmp[i++] = (unsigned char)t;
+ }
} else {
for (;;) {