Don't shift serial number into sign bit
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 01c32b5e44
)
This commit is contained in:
parent
298d823bf8
commit
0199251318
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue