diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2019-04-15 17:46:03 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2019-04-15 17:46:03 +0000 |
commit | fb53db5b99f746a39653ea270b481fbf8d52bffd (patch) | |
tree | ec7a4329d6745754b98d53091645b66f14c09902 | |
parent | ce41a2555f5e7a5db17c1c6f98b739c80bc7400e (diff) |
Avoid signed integer overflow.
Fixes oss-fuzz issue #13843.
ok tb@
-rw-r--r-- | lib/libcrypto/asn1/x_long.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/asn1/x_long.c b/lib/libcrypto/asn1/x_long.c index 61685c31a37..8b11f14217f 100644 --- a/lib/libcrypto/asn1/x_long.c +++ b/lib/libcrypto/asn1/x_long.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_long.c,v 1.14 2019/04/01 15:48:50 jsing Exp $ */ +/* $OpenBSD: x_long.c,v 1.15 2019/04/15 17:46:02 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -195,8 +195,8 @@ long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, } ltmp = (long)utmp; if (neg) { - ltmp++; ltmp = -ltmp; + ltmp--; } if (ltmp == it->size) { ASN1error(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); |