diff options
author | Kurt Roeckx <kurt@roeckx.be> | 2016-05-21 16:53:14 +0200 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2016-05-22 12:05:15 +0200 |
commit | 1544583bbc2b60f1a4f456ca591495c215e661c2 (patch) | |
tree | 1ee007860a7556f33b275d6c266f6795ae6e7ae8 /crypto/bn | |
parent | acc600928dfddebb6f0dc5a44dee35339e8820fb (diff) | |
download | openssl-1544583bbc2b60f1a4f456ca591495c215e661c2.zip openssl-1544583bbc2b60f1a4f456ca591495c215e661c2.tar.gz openssl-1544583bbc2b60f1a4f456ca591495c215e661c2.tar.bz2 |
Avoid creating an illegal pointer
Found by tis-interpreter
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #1106
Diffstat (limited to 'crypto/bn')
-rw-r--r-- | crypto/bn/bn_lib.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index 7c43402..ccdefb3 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); |