From: Rasmus Lerdorf Date: Sun, 7 Aug 2011 00:36:26 +0000 (+0000) Subject: I'm pretty sure you didn't mean to multiple by the size of a char* there X-Git-Tag: php-5.4.0beta1~508 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7a92c97093e80f06f25b0a998884170748d09b6;p=php I'm pretty sure you didn't mean to multiple by the size of a char* there since that makes no sense. output is an array of char, not an array of char* Pierre, please review --- diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 181a4d4931..da1a3b3a67 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -200,7 +200,7 @@ PHP_FUNCTION(crypt) int needed = (sizeof(sha512_salt_prefix) - 1 + sizeof(sha512_rounds_prefix) + 9 + 1 + strlen(salt) + 1 + 43 + 1); - output = emalloc(needed * sizeof(char *)); + output = emalloc(needed); salt[salt_in_len] = '\0'; crypt_res = php_sha512_crypt_r(str, salt, output, needed); @@ -223,7 +223,7 @@ PHP_FUNCTION(crypt) int needed = (sizeof(sha256_salt_prefix) - 1 + sizeof(sha256_rounds_prefix) + 9 + 1 + strlen(salt) + 1 + 43 + 1); - output = emalloc(needed * sizeof(char *)); + output = emalloc(needed); salt[salt_in_len] = '\0'; crypt_res = php_sha256_crypt_r(str, salt, output, needed);