mirror of
https://github.com/weechat/weechat.git
synced 2026-06-23 03:16:37 +02:00
scripts: fix crash when a signal is received with type "int" and NULL pointer in signal_data
This commit is contained in:
@@ -2508,7 +2508,7 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
|
||||
struct t_plugin_script_cb *script_callback;
|
||||
void *func_argv[3];
|
||||
char empty_arg[1] = { '\0' };
|
||||
static char value_str[64];
|
||||
static char str_value[64];
|
||||
int *rc, ret, free_needed;
|
||||
|
||||
script_callback = (struct t_plugin_script_cb *)data;
|
||||
@@ -2524,9 +2524,13 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
|
||||
}
|
||||
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
|
||||
{
|
||||
snprintf (value_str, sizeof (value_str) - 1,
|
||||
"%d", *((int *)signal_data));
|
||||
func_argv[2] = value_str;
|
||||
str_value[0] = '\0';
|
||||
if (signal_data)
|
||||
{
|
||||
snprintf (str_value, sizeof (str_value),
|
||||
"%d", *((int *)signal_data));
|
||||
}
|
||||
func_argv[2] = str_value;
|
||||
}
|
||||
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user