diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-22 17:10:01 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-22 17:10:01 +0100 |
commit | 0c3835d82470f7dff15fd6ece6f7ded0520e3419 (patch) | |
tree | 917681a6f664f21910987850bc2ee52eac1a37e2 /src/plugins/guile/weechat-guile-api.c | |
parent | a08679c887b5ec542d2da39ade1fbc1c806c732b (diff) | |
download | weechat-0c3835d82470f7dff15fd6ece6f7ded0520e3419.zip |
scripts: fix crash when a signal is received with type "int" and NULL pointer in signal_data
Diffstat (limited to 'src/plugins/guile/weechat-guile-api.c')
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 12 |
1 files changed, 8 insertions, 4 deletions
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) { |