summaryrefslogtreecommitdiff
path: root/ext/mcrypt
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-05-31 12:06:36 +0000
committerAntony Dovgal <tony2001@php.net>2006-05-31 12:06:36 +0000
commit47edd8a303d27afe9ac8f84d0e923c713d294670 (patch)
tree5a57aca6f13f5b0684d289d09a33e20687c9af50 /ext/mcrypt
parent42f32bfa4b00482858edb021257025c788143b7d (diff)
downloadphp-git-47edd8a303d27afe9ac8f84d0e923c713d294670.tar.gz
MFH: fix #37595 (mcrypt_generic calculates data length in wrong way)
Diffstat (limited to 'ext/mcrypt')
-rw-r--r--ext/mcrypt/mcrypt.c2
-rw-r--r--ext/mcrypt/tests/bug37595.phptbin0 -> 988 bytes
2 files changed, 1 insertions, 1 deletions
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 878c883611..a76ae2ee58 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -496,7 +496,7 @@ PHP_FUNCTION(mcrypt_generic)
/* Check blocksize */
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
block_size = mcrypt_enc_get_block_size(pm->td);
- data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
+ data_size = ((Z_STRLEN_PP(data) / block_size) + 1) * block_size;
data_s = emalloc(data_size + 1);
memset(data_s, 0, data_size);
memcpy(data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
diff --git a/ext/mcrypt/tests/bug37595.phpt b/ext/mcrypt/tests/bug37595.phpt
new file mode 100644
index 0000000000..a74b8cfaa8
--- /dev/null
+++ b/ext/mcrypt/tests/bug37595.phpt
Binary files differ