svn: /pecl/newt/trunk/ newt.c
| From: | Remi Collet | Date: | Sun, 13 Oct 2013 15:38:00 +0000 |
| Subject: | svn: /pecl/newt/trunk/ newt.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-19870@lists.php.net to get a copy of this message | ||
remi Sun, 13 Oct 2013 15:38:00 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=331797
Log:
Fix bug #64990 Segmentation Fault @ newt_checkbox_tree_add_item
Bug: https://bugs.php.net/64990 (Open) Segmentation Fault @
newt_checkbox_tree_add_item
Changed paths:
U pecl/newt/trunk/newt.c
Modified: pecl/newt/trunk/newt.c
===================================================================
--- pecl/newt/trunk/newt.c 2013-10-13 15:12:56 UTC (rev 331796)
+++ pecl/newt/trunk/newt.c 2013-10-13 15:38:00 UTC (rev 331797)
@@ -1932,7 +1932,7 @@
int argc = ZEND_NUM_ARGS();
if (argc < 5) { WRONG_PARAM_COUNT; }
- if (zend_parse_parameters ((argc - 1) TSRMLS_CC, "rszl", &z_checkboxtree, &text,
&text_len, &z_data, &flags) == FAILURE) {
+ if (zend_parse_parameters (4 TSRMLS_CC, "rszl", &z_checkboxtree, &text,
&text_len, &z_data, &flags) == FAILURE) {
return;
}
@@ -1946,7 +1946,7 @@
PHP_NEWT_STORE_DATA (z_data, key);
- newt_args = (void **) safe_emalloc (argc, sizeof(void *), 0);
+ newt_args = (void **) safe_emalloc (argc+1, sizeof(void *), 0);
newt_args[0] = (void *)checkboxtree;
newt_args[1] = (void *)text;
newt_args[2] = (void *)key;
@@ -1961,9 +1961,10 @@
}
newt_args[i] = (void *)Z_LVAL_PP(args[i]);
}
+ /* add NEWT_ARG_LAST is forgotten by user to avoid segfault, bug #64990 */
+ newt_args[argc] = (void *)NEWT_ARG_LAST;
+ newt_vcall ((void *)newtCheckboxTreeAddItem, newt_args, argc+1);
- newt_vcall ((void *)newtCheckboxTreeAddItem, newt_args, argc);
-
efree (newt_args);
efree (args);
}