diff options
author | Stanislav Malyshev <stas@php.net> | 2010-04-20 00:45:07 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2010-04-20 00:45:07 +0000 |
commit | 129019b9fc3b5e47e710592c855242777dfc8141 (patch) | |
tree | 1aafb996276fae4cde5b4dede26e7d7e5b359515 | |
parent | 213436c3fbfe76bb7b2be3bb507da605adb5e98d (diff) | |
download | php-git-129019b9fc3b5e47e710592c855242777dfc8141.tar.gz |
fix 64-bit integer overflow in mhash_keygen_s2k
-rw-r--r-- | ext/hash/hash.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 0eb0c7c956..4c1222f001 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -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; |