com php-src: more fixes to ext/mcrypt: ext/mcrypt/mcrypt.c

From: Date: Mon, 10 Mar 2014 10:15:34 +0000
Subject: com php-src: more fixes to ext/mcrypt: ext/mcrypt/mcrypt.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-76407@lists.php.net to get a copy of this message
Commit: 8cea765858cd5bef7e83430e7dc82bd57ac03ebe Author: Anatol Belski <ab@php.net> Mon, 10 Mar 2014 11:15:34 +0100 Parents: 0190e37ec662ae2c4968fcc24c531299e119b354 Branches: str_size_and_int64_56_backport Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8cea765858cd5bef7e83430e7dc82bd57ac03ebe Log: more fixes to ext/mcrypt Changed paths: M ext/mcrypt/mcrypt.c Diff: diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 6f5a4ec..f027727 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -1237,7 +1237,7 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, php_size_t key_le { char *cipher_dir_string; char *module_dir_string; - unsigned long int data_size; + php_size_t data_size; char *data_s; MCRYPT td; @@ -1262,7 +1262,11 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, php_size_t key_le /* Check blocksize */ if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */ php_size_t block_size = mcrypt_enc_get_block_size(td); - data_size = (((data_len - 1) / block_size) + 1) * block_size; + if (data_len > 0) { + data_size = (((data_len - 1) / block_size) + 1) * block_size; + } else { + data_size = block_size; + } data_s = emalloc(data_size + 1); memset(data_s, 0, data_size); memcpy(data_s, data, data_len);

« previous php.cvs (#76407) next »