mirror of
https://github.com/openssl/openssl.git
synced 2025-02-17 14:32:04 +08:00
Fix undefined behaviour when printing the X509 serial
Found by afl Reviewed-by: Andy Polyakov <appro@openssl.org> GH: #2230
This commit is contained in:
parent
a470f02360
commit
244d7b288f
@ -93,12 +93,14 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
|
||||
l = -1;
|
||||
}
|
||||
if (l != -1) {
|
||||
unsigned long ul;
|
||||
if (bs->type == V_ASN1_NEG_INTEGER) {
|
||||
l = -l;
|
||||
ul = 0 - (unsigned long)l;
|
||||
neg = "-";
|
||||
} else
|
||||
ul = l;
|
||||
neg = "";
|
||||
if (BIO_printf(bp, " %s%lu (%s0x%lx)\n", neg, l, neg, l) <= 0)
|
||||
if (BIO_printf(bp, " %s%lu (%s0x%lx)\n", neg, ul, neg, ul) <= 0)
|
||||
goto err;
|
||||
} else {
|
||||
neg = (bs->type == V_ASN1_NEG_INTEGER) ? " (Negative)" : "";
|
||||
|
Loading…
Reference in New Issue
Block a user