summaryrefslogtreecommitdiff
path: root/crypto/asn1/a_object.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-08-05 14:33:03 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-08-16 00:19:19 +0100
commit8b9afbc0fc7f8be0049d389d34d9416fa377e2aa (patch)
treebf8b3b64465d23d21be7bb37e99155fffd6bb669 /crypto/asn1/a_object.c
parent07bed46f332fce8c1d157689a2cdf915a982ae34 (diff)
downloadopenssl-new-8b9afbc0fc7f8be0049d389d34d9416fa377e2aa.tar.gz
Check for errors in a2d_ASN1_OBJECT()
Check for error return in BN_div_word(). Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/asn1/a_object.c')
-rw-r--r--crypto/asn1/a_object.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c
index 6fc7681c23..79f0ecd2a8 100644
--- a/crypto/asn1/a_object.c
+++ b/crypto/asn1/a_object.c
@@ -127,8 +127,12 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
if (tmp == NULL)
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 (;;) {