projects
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
298d823
)
Don't shift serial number into sign bit
author
Dr. Stephen Henson
<steve@openssl.org>
Fri, 4 Mar 2016 18:04:46 +0000
(18:04 +0000)
committer
Dr. Stephen Henson
<steve@openssl.org>
Mon, 7 Mar 2016 15:19:58 +0000
(15:19 +0000)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit
01c32b5e448f6d42a23ff16bdc6bb0605287fa6f
)
crypto/asn1/t_x509.c
patch
|
blob
|
history
diff --git
a/crypto/asn1/t_x509.c
b/crypto/asn1/t_x509.c
index 4e7c45dd5ddc8948a8c12cf444e4eef6c145f16a..4f69b5113f988bee4de2ca2f5f0587d0cc25fc7c 100644
(file)
--- 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);
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;
l = ASN1_INTEGER_get(bs);
if (bs->type == V_ASN1_NEG_INTEGER) {
l = -l;