Add explanatory comment about fitting into a size_t.
authorPauli <paul.dale@oracle.com>
Thu, 14 Sep 2017 22:01:42 +0000 (08:01 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 14 Sep 2017 23:02:00 +0000 (09:02 +1000)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4373)

crypto/evp/pbe_scrypt.c

index 80a1acd2ce143200cc676945b571173c75193c13..b30e6d571998f41e9208d51a53247f54e964e89e 100644 (file)
@@ -207,6 +207,8 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen,
 
     if (maxmem == 0)
         maxmem = SCRYPT_MAX_MEM;
 
     if (maxmem == 0)
         maxmem = SCRYPT_MAX_MEM;
+
+    /* Check that the maximum memory doesn't exceed a size_t limits */
     if (maxmem > SIZE_MAX)
         maxmem = SIZE_MAX;
 
     if (maxmem > SIZE_MAX)
         maxmem = SIZE_MAX;