Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2016-03-15 02:23:58 +0300
committerDavid Benjamin <davidben@google.com>2016-03-17 21:23:49 +0300
commiteebfd896fe178b4ca78bbd8064944a5b31a27667 (patch)
tree0c2bbf3b2c0c2c3c1fa3319d452fe53845e6ef4f /crypto/x509
parent8d5717b019b5540a72dceefd747d02a72d539dda (diff)
Don't shift serial number into sign bit
(Imported from upstream's 01c32b5e448f6d42a23ff16bdc6bb0605287fa6f.) Change-Id: Ib52278dbbac1ed1ad5c80f0ad69e34584d411cec Reviewed-on: https://boringssl-review.googlesource.com/7461 Reviewed-by: Steven Valdez <svaldez@google.com> Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto/x509')
-rw-r--r--crypto/x509/t_x509.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/x509/t_x509.c b/crypto/x509/t_x509.c
index b2623610..1fba9b43 100644
--- a/crypto/x509/t_x509.c
+++ b/crypto/x509/t_x509.c
@@ -133,7 +133,8 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
goto err;
bs = X509_get_serialNumber(x);
- if (bs->length <= (int)sizeof(long)) {
+ if (bs->length < (int)sizeof(long)
+ || (bs->length == sizeof(long) && (bs->data[0] & 0x80) == 0)) {
l = ASN1_INTEGER_get(bs);
if (bs->type == V_ASN1_NEG_INTEGER) {
l = -l;