diff options
author | David Benjamin <davidben@google.com> | 2016-08-16 08:52:38 +0300 |
---|---|---|
committer | CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org> | 2016-08-16 22:45:32 +0300 |
commit | 2a795a1775db47d9346d41e77d940534291c1b1a (patch) | |
tree | aec52d845e4b9c44143f9b367be349b1696b7520 /crypto | |
parent | 55d9038de59074f3a92c61dbf8a5c35650ace02d (diff) |
Check for errors in a2d_ASN1_OBJECT()
Check for error return in BN_div_word().
(Imported from upstream's d871284aca5524c85a6460119ac1b1e38f7e19c6.)
This function is only called from crypto/obj to convert strings like
"1.2.3.4.5" to OIDs. We may wish to see about rewriting it just so it's
out of the way.
Change-Id: Ia8379d2dd30606f6a81ce24dee8852312cb7f127
Reviewed-on: https://boringssl-review.googlesource.com/10365
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Diffstat (limited to 'crypto')
-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 561eb14e..fef9b799 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -172,8 +172,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 (;;) { |