Fix memory over-read

Fix from David Baggett via tweet.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Rich Salz 2015-08-27 17:17:26 -04:00 committed by Rich Salz
parent c03726ca41
commit 3c65047d30

View File

@ -553,7 +553,7 @@ BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
return (NULL);
bn_check_top(ret);
/* Skip leading zero's. */
for ( ; *s == 0 && len > 0; s++, len--)
for ( ; len > 0 && *s == 0; s++, len--)
continue;
n = len;
if (n == 0) {