summaryrefslogtreecommitdiff
path: root/ext/mcrypt/mcrypt.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-12-10 23:24:11 +0300
committerDmitry Stogov <dmitry@zend.com>2014-12-10 23:24:11 +0300
commite087d3ac7f78a2bfea01ce7c94e18b4c89073003 (patch)
treee5b1f6f1beb6098ff245385f8737de9bc1690f14 /ext/mcrypt/mcrypt.c
parentba35b22bc4a7af791ff2ab7c2ca8e9f4aa6d64df (diff)
parent92a9477cc399c78f6570beec22b8f1408179aefe (diff)
downloadphp-git-e087d3ac7f78a2bfea01ce7c94e18b4c89073003.tar.gz
Merge branch 'master' into native-tls
* master: (23 commits) move the test to the right place fix TS build and C89 compat updated NEWS Fixed bug #68545 NULL pointer dereference in unserialize.c Updated NEWS Updated NEWS Updated NEWS NEWS Fix bug #68526 Implement POSIX Access Control List for UDS Improved basic zval copying primitives: ZVAL_COPY_VALUE(), ZVAL_COPY(), ZVAL_DUP() Wrap RETURN_VALUE_USED() with EXPECTED() or UNEXPECTED() macros according to more frequent usage patterns. Improved ASSIGN_<OP>, ASSIGN_DIM and UNSET_DIM drop dead/unused code simplified code Move ZVAL_DEREF() and make_real_object() into slow paths. Pass znode_op structure by value (it fits into one word) instead of pointer to structure. Move checks for references into slow paths. Improved ASSIGN_DIM and ASSIGN_OBJ Fixed typo Move checks for references into slow paths of handlers or helpers. Remove duplicate opcode handlers. ...
Diffstat (limited to 'ext/mcrypt/mcrypt.c')
-rw-r--r--ext/mcrypt/mcrypt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 4341bbe5c1..d33cdd5972 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -579,8 +579,11 @@ PHP_FUNCTION(mcrypt_generic_init)
if (iv_len != iv_size) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iv size incorrect; supplied length: %d, needed: %d", iv_len, iv_size);
+ if (iv_len > iv_size) {
+ iv_len = iv_size;
+ }
}
- memcpy(iv_s, iv, iv_size);
+ memcpy(iv_s, iv, iv_len);
mcrypt_generic_deinit(pm->td);
result = mcrypt_generic_init(pm->td, key_s, key_size, iv_s);
@@ -601,8 +604,9 @@ PHP_FUNCTION(mcrypt_generic_init)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error");
break;
}
+ } else {
+ pm->init = 1;
}
- pm->init = 1;
RETVAL_LONG(result);
efree(iv_s);