The branch OpenSSL_1_0_1-stable has been updated
       via  01992513186f3954934d08ef500bfd7cd55306a0 (commit)
      from  298d823bf8dcf18d678b2f14124648356bcee313 (commit)


- Log -----------------------------------------------------------------
commit 01992513186f3954934d08ef500bfd7cd55306a0
Author: Dr. Stephen Henson <[email protected]>
Date:   Fri Mar 4 18:04:46 2016 +0000

    Don't shift serial number into sign bit
    
    Reviewed-by: Rich Salz <[email protected]>
    (cherry picked from commit 01c32b5e448f6d42a23ff16bdc6bb0605287fa6f)

-----------------------------------------------------------------------

Summary of changes:
 crypto/asn1/t_x509.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/asn1/t_x509.c b/crypto/asn1/t_x509.c
index 4e7c45d..4f69b51 100644
--- a/crypto/asn1/t_x509.c
+++ b/crypto/asn1/t_x509.c
@@ -140,7 +140,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;
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to