]> granicus.if.org Git - php/commitdiff
I'm pretty sure you didn't mean to multiple by the size of a char* there
authorRasmus Lerdorf <rasmus@php.net>
Sun, 7 Aug 2011 00:36:26 +0000 (00:36 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Sun, 7 Aug 2011 00:36:26 +0000 (00:36 +0000)
since that makes no sense. output is an array of char, not an array of
char*
Pierre, please review

ext/standard/crypt.c

index fda95d8f9cbe9ce5b08df9c1bb6662b252647cd7..865a25beb1951969cd7c8f929004d59fb445087f 100644 (file)
@@ -198,7 +198,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);
@@ -221,7 +221,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);