1
0
mirror of https://github.com/php/php-src.git synced 2026-04-08 08:33:06 +02:00

Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  Fix some lengths in crypt()

Conflicts:
	ext/standard/crypt.c
This commit is contained in:
Nikita Popov
2012-06-29 13:15:35 +02:00

View File

@@ -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] == '$' &&