From: Kurt Roeckx Date: Sat, 21 May 2016 14:53:14 +0000 (+0200) Subject: Avoid creating an illegal pointer X-Git-Tag: OpenSSL_1_1_0-pre6~742 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1544583bbc2b60f1a4f456ca591495c215e661c2;p=oweals%2Fopenssl.git Avoid creating an illegal pointer Found by tis-interpreter Reviewed-by: Rich Salz GH: #1106 --- diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index 7c434020de..ccdefb354f 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -1022,9 +1022,11 @@ void bn_correct_top(BIGNUM *a) int tmp_top = a->top; if (tmp_top > 0) { - for (ftl = &(a->d[tmp_top - 1]); tmp_top > 0; tmp_top--) - if (*(ftl--)) + for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { + ftl--; + if (*ftl != 0) break; + } a->top = tmp_top; } bn_pollute(a);