Browse Source

MFH: fix #37595 (mcrypt_generic calculates data length in wrong way)

PECL_OPENSSL
Antony Dovgal 20 years ago
parent
commit
47edd8a303
  1. 2
      NEWS
  2. 2
      ext/mcrypt/mcrypt.c
  3. BIN
      ext/mcrypt/tests/bug37595.phpt

2
NEWS

@ -55,6 +55,8 @@ PHP NEWS
- Fixed bug #37616 (DATE_RFC822 does not product RFC 822 dates).
(Hannes Magnusson, Derick)
- Fixed bug #37614 (Class name lowercased in error message). (Johannes)
- Fixed bug #37595 (mcrypt_generic calculates data length in wrong way).
(Tony)
- Fixed bug #37587 (var without attribute causes segfault). (Marcus)
- Fixed bug #37586 (Bumped minimum PCRE version to 6.6, needed for recursion
limit support). (Ilia)

2
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));

BIN
ext/mcrypt/tests/bug37595.phpt

Loading…
Cancel
Save