diff options
author | Felipe Pena <felipe@php.net> | 2011-11-22 12:47:08 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2011-11-22 12:47:08 +0000 |
commit | 4fffb5f5e0f713089c3f49a457caaef126032403 (patch) | |
tree | 67e185af0c9c336515af07cf3268e9aca9c9e0a3 | |
parent | 735dc01811c71fc58af56a4dd306acfc11b425a5 (diff) | |
download | php-git-4fffb5f5e0f713089c3f49a457caaef126032403.tar.gz |
- Fixed invalid free in call_user_method() function
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 4 | ||||
-rw-r--r-- | ext/standard/tests/general_functions/call_user_method_002.phpt | 12 |
3 files changed, 16 insertions, 1 deletions
@@ -10,6 +10,7 @@ PHP NEWS (klightspeed at netspace dot net dot au) . Fixed bug #52624 (tempnam() by-pass open_basedir with nonnexistent directory). (Felipe) + . Fixed invalid free in call_user_method() function. (Felipe) - Zend Engine: . Fixed bug #43200 (Interface implementation / inheritence not possible in diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 58e36c3cff..ba8b121f1e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4825,7 +4825,9 @@ PHP_FUNCTION(call_user_method) Z_TYPE_P(object) != IS_STRING ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument is not an object or class name"); - efree(params); + if (params) { + efree(params); + } RETURN_FALSE; } diff --git a/ext/standard/tests/general_functions/call_user_method_002.phpt b/ext/standard/tests/general_functions/call_user_method_002.phpt new file mode 100644 index 0000000000..054bc3edeb --- /dev/null +++ b/ext/standard/tests/general_functions/call_user_method_002.phpt @@ -0,0 +1,12 @@ +--TEST-- +call_user_method() Invalid free +--FILE-- +<?php + +call_user_method("1", $arr1); + +?> +--EXPECTF-- +Deprecated: Function call_user_method() is deprecated in %s on line %d + +Warning: call_user_method(): Second argument is not an object or class name in %s on line %d |