summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2012-06-29 13:15:53 +0200
committerNikita Popov <nikic@php.net>2012-06-29 13:15:53 +0200
commit0b96fb4af55d0d18b9813dc2151918a05275481b (patch)
tree0de5b73ed6eb7cba1696b330a57fc6fdb086c28c /ext
parente778b03307ef51a501136f6876495dc2e7409e41 (diff)
parentd86b6ea35c5e0afefb373979cb743098178a0a07 (diff)
downloadphp-git-0b96fb4af55d0d18b9813dc2151918a05275481b.tar.gz
Merge branch 'PHP-5.4'
* PHP-5.4: Fix some lengths in crypt()
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/crypt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 3ade86a068..27a8d82d0e 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -199,7 +199,7 @@ PHP_FUNCTION(crypt)
char *output;
int needed = (sizeof(sha512_salt_prefix) - 1
+ sizeof(sha512_rounds_prefix) + 9 + 1
- + PHP_MAX_SALT_LEN + 1 + 43 + 1);
+ + salt_in_len + 1 + 86 + 1);
output = emalloc(needed);
salt[salt_in_len] = '\0';
@@ -214,7 +214,7 @@ PHP_FUNCTION(crypt)
RETVAL_STRING(output, 1);
}
- memset(output, 0, PHP_MAX_SALT_LEN + 1);
+ memset(output, 0, needed);
efree(output);
} else if (salt[0]=='$' && salt[1]=='5' && salt[2]=='$') {
const char sha256_salt_prefix[] = "$5$";
@@ -222,7 +222,7 @@ PHP_FUNCTION(crypt)
char *output;
int needed = (sizeof(sha256_salt_prefix) - 1
+ sizeof(sha256_rounds_prefix) + 9 + 1
- + PHP_MAX_SALT_LEN + 1 + 43 + 1);
+ + salt_in_len + 1 + 43 + 1);
output = emalloc(needed);
salt[salt_in_len] = '\0';
@@ -237,7 +237,7 @@ PHP_FUNCTION(crypt)
RETVAL_STRING(output, 1);
}
- memset(output, 0, PHP_MAX_SALT_LEN + 1);
+ memset(output, 0, needed);
efree(output);
} else if (
salt[0] == '$' &&