summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index fc5bd14584..23fce3ce43 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -180,6 +180,11 @@ ZEND_FUNCTION(func_get_arg)
convert_to_long_ex(z_requested_offset);
requested_offset = (*z_requested_offset)->value.lval;
+ if (requested_offset < 0) {
+ zend_error(E_WARNING, "func_get_arg(): The argument number should be >= 0");
+ RETURN_FALSE;
+ }
+
p = EG(argument_stack).top_element-1-1;
arg_count = (ulong) *p; /* this is the amount of arguments passed to func_get_arg(); */
p -= 1+arg_count;