summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2016-06-23 09:37:51 +0200
committerRichard Levitte <levitte@openssl.org>2017-03-20 22:10:54 +0100
commit2cbd4d98673d99cd7cb10715656b6d3727342e77 (patch)
tree49237492f69f89566efc6b541178648e93de56ae /crypto
parente6c53b0ced916633c8038736fde5613bf5b3e0dc (diff)
Avoid signed overflow
Found by afl Reviewed-by: Rich Salz <rsalz@openssl.org> MR: #3013 (cherry picked from commit 5bea15ebb359c91a1bb7569620ead14bb71cfb81)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/x_long.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c
index 3aed44a3dd..98562a18ba 100644
--- a/crypto/asn1/x_long.c
+++ b/crypto/asn1/x_long.c
@@ -178,8 +178,8 @@ static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
}
ltmp = (long)utmp;
if (neg) {
- ltmp++;
ltmp = -ltmp;
+ ltmp--;
}
if (ltmp == it->size) {
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);