summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2019-04-15 17:46:03 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2019-04-15 17:46:03 +0000
commitfb53db5b99f746a39653ea270b481fbf8d52bffd (patch)
treeec7a4329d6745754b98d53091645b66f14c09902
parentce41a2555f5e7a5db17c1c6f98b739c80bc7400e (diff)
Avoid signed integer overflow.
Fixes oss-fuzz issue #13843. ok tb@
-rw-r--r--lib/libcrypto/asn1/x_long.c4
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);