Fix memory over-read
[openssl.git] / 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) {