From: Kurt Roeckx Date: Tue, 24 May 2016 19:32:01 +0000 (+0200) Subject: Avoid creating an illegal pointer X-Git-Tag: OpenSSL_1_1_0-pre6~698 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dc9887c0199f5b7579e7b82dd7910008e419816f;p=oweals%2Fopenssl.git Avoid creating an illegal pointer Found by tis-interpreter Reviewed-by: Rich Salz GH: #1122 --- diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index d06d4178dd..9c28c02951 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -201,18 +201,18 @@ static size_t c2i_ibuf(unsigned char *b, int *pneg, /* Must be negative: calculate twos complement */ if (b) { const unsigned char *from = p + plen - 1 + pad; - unsigned char *to = b + plen - 1; + unsigned char *to = b + plen; i = plen; while (*from == 0 && i) { - *to-- = 0; + *--to = 0; i--; from--; } - *to-- = (*from-- ^ 0xff) + 1; + *--to = (*from-- ^ 0xff) + 1; OPENSSL_assert(i != 0); i--; for (; i > 0; i--) - *to-- = *from-- ^ 0xff; + *--to = *from-- ^ 0xff; } return plen; }