summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-01-08 13:49:15 +0100
committerSébastien Helleu <flashcode@flashtux.org>2023-01-08 14:04:05 +0100
commitfe7c0019a75a4dbb7cfff814769e36a11890c09e (patch)
treec1987fbf208fb8179fc1fd02bbe4871def82f759
parente101d5d8a465322c4213e585d742ab647c93ceab (diff)
downloadweechat-fe7c0019a75a4dbb7cfff814769e36a11890c09e.zip
php: remove warnings on variables "argc" and "ret_i" that might be clobbered by longjmp or vfork
-rw-r--r--src/plugins/php/weechat-php.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c
index 043d73336..4e557d31a 100644
--- a/src/plugins/php/weechat-php.c
+++ b/src/plugins/php/weechat-php.c
@@ -545,7 +545,6 @@ weechat_php_exec (struct t_plugin_script *script, int ret_type,
zval *params;
zval zretval;
void *ret_value;
- int *ret_i;
zend_fcall_info fci;
zend_fcall_info_cache fci_cache;
struct t_plugin_script *old_php_current_script;
@@ -558,14 +557,12 @@ weechat_php_exec (struct t_plugin_script *script, int ret_type,
/* Build func args */
if (!format || !format[0])
{
- argc = 0;
params = NULL;
}
else
{
argc = strlen (format);
params = safe_emalloc (sizeof (zval), argc, 0);
-
for (i = 0; i < argc; i++)
{
switch (format[i])
@@ -596,7 +593,7 @@ weechat_php_exec (struct t_plugin_script *script, int ret_type,
if (zfunc && zend_fcall_info_init (zfunc, 0, &fci, &fci_cache, NULL, NULL) == SUCCESS)
{
fci.params = params;
- fci.param_count = argc;
+ fci.param_count = (format) ? strlen (format) : 0;
fci.retval = &zretval;
}
@@ -619,9 +616,8 @@ weechat_php_exec (struct t_plugin_script *script, int ret_type,
else if (ret_type == WEECHAT_SCRIPT_EXEC_INT)
{
convert_to_long (&zretval);
- ret_i = malloc (sizeof (*ret_i));
- *ret_i = Z_LVAL(zretval);
- ret_value = ret_i;
+ ret_value = malloc (sizeof (int));
+ *((int *)ret_value) = Z_LVAL(zretval);
}
else if (ret_type == WEECHAT_SCRIPT_EXEC_HASHTABLE)
{
@@ -662,6 +658,7 @@ weechat_php_exec (struct t_plugin_script *script, int ret_type,
/* Cleanup */
if (params)
{
+ argc = (format) ? strlen (format) : 0;
for (i = 0; i < argc; i++)
{
zval_ptr_dtor (&params[i]);