diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-08-05 14:33:03 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-08-16 00:20:34 +0100 |
commit | d871284aca5524c85a6460119ac1b1e38f7e19c6 (patch) | |
tree | ae67dbaca911741bc0cd40a7b0fc71d1f4f8e5a4 /crypto/asn1/a_object.c | |
parent | 657566ead90132f68aa2c9a407c9d3920476446c (diff) |
Check for errors in a2d_ASN1_OBJECT()
Check for error return in BN_div_word().
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 8b9afbc0fc7f8be0049d389d34d9416fa377e2aa)
Diffstat (limited to 'crypto/asn1/a_object.c')
-rw-r--r-- | crypto/asn1/a_object.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c index fba9f66454..229a40ffa3 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -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 (;;) { |