mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
fix 64-bit integer overflow in mhash_keygen_s2k
This commit is contained in:
parent
213436c3fb
commit
129019b9fc
1 changed files with 4 additions and 2 deletions
|
@ -744,15 +744,17 @@ PHP_FUNCTION(mhash_get_block_size)
|
|||
Generates a key using hash functions */
|
||||
PHP_FUNCTION(mhash_keygen_s2k)
|
||||
{
|
||||
long algorithm, bytes;
|
||||
long algorithm, l_bytes;
|
||||
int bytes;
|
||||
char *password, *salt;
|
||||
int password_len, salt_len;
|
||||
char padded_salt[SALT_SIZE];
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lssl", &algorithm, &password, &password_len, &salt, &salt_len, &bytes) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lssl", &algorithm, &password, &password_len, &salt, &salt_len, &l_bytes) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
bytes = (int)l_bytes;
|
||||
if (bytes <= 0){
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "the byte parameter must be greater than 0");
|
||||
RETURN_FALSE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue