Fix memory over-read
authorRich Salz <rsalz@akamai.com>
Thu, 27 Aug 2015 21:17:26 +0000 (17:17 -0400)
committerRich Salz <rsalz@openssl.org>
Thu, 27 Aug 2015 21:29:46 +0000 (17:29 -0400)
Fix from David Baggett via tweet.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/bn/bn_lib.c

index c8e8519d8ba34b7fd7fcd678fb9680a304d23bfa..2ca6beab364d801df75c2230572668644941d68f 100644 (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) {