diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 12 | ||||
-rw-r--r-- | src/plugins/lua/weechat-lua-api.c | 12 | ||||
-rw-r--r-- | src/plugins/perl/weechat-perl-api.c | 12 | ||||
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 12 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 12 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl-api.c | 12 |
7 files changed, 50 insertions, 24 deletions
@@ -49,6 +49,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * perl: fix context used after unload of a script * python: fix interpreter used after unload of a script * relay: fix NULL pointer when reading buffer lines for irc backlog +* scripts: fix crash when a signal is received with type "int" and NULL pointer + in signal_data * trigger: add trigger plugin: new command /trigger and file trigger.conf == Version 0.4.3 (2014-02-09) diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 2136092b7..f32a166f3 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -2365,7 +2365,7 @@ weechat_guile_api_hook_signal_cb (void *data, const char *signal, 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; @@ -2381,9 +2381,13 @@ weechat_guile_api_hook_signal_cb (void *data, const char *signal, } 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) { diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index 62c765b54..3d1ad927e 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -2566,7 +2566,7 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal, 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; @@ -2582,9 +2582,13 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal, } 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) { diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 32e8f3e7b..83ba39a2b 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -2399,7 +2399,7 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ 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; @@ -2415,9 +2415,13 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ } 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) { diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 91812fae1..9abc3c2d9 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -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) { diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 96fe8824b..eab74e7d9 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -2928,7 +2928,7 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ 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; @@ -2944,9 +2944,13 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ } 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) { diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index 804da959a..ae7d4d40e 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -2837,7 +2837,7 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type 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; @@ -2853,9 +2853,13 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type } 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) { |