From 6a2ecc90b3493e818090a9812bada1a84a2d498c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 30 Mar 2023 22:02:12 +0200 Subject: [PATCH] spell: check buffer pointer received in info "spell_dict" --- ChangeLog.adoc | 1 + src/plugins/spell/spell-info.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 06a4e4474..51eb9d5f7 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -54,6 +54,7 @@ Bug fixes:: * buflist: do not display keys added in default context on first load * fset: remove scroll to top of fset buffer when options are added or removed (issue #1892) * irc: fix join of channels in "autojoin" server option on first connection to server if auto reconnection is performed (issue #1873) + * spell: check buffer pointer received in info "spell_dict" * typing: fix crash when pointer buffer is not received in callback for signal "input_text_changed" (issue #1869) Tests:: diff --git a/src/plugins/spell/spell-info.c b/src/plugins/spell/spell-info.c index 2fa458da2..01399adad 100644 --- a/src/plugins/spell/spell-info.c +++ b/src/plugins/spell/spell-info.c @@ -55,10 +55,11 @@ spell_info_info_spell_dict_cb (const void *pointer, void *data, if (strncmp (arguments, "0x", 2) == 0) { rc = sscanf (arguments, "%lx", &value); - if ((rc != EOF) && (rc != 0)) + if ((rc != EOF) && (rc != 0) && value) { buffer = (struct t_gui_buffer *)value; - if (buffer) + if (weechat_hdata_check_pointer (weechat_hdata_get ("buffer"), + NULL, buffer)) { buffer_full_name = weechat_buffer_get_string (buffer, "full_name"); @@ -66,7 +67,9 @@ spell_info_info_spell_dict_cb (const void *pointer, void *data, } } else + { buffer_full_name = arguments; + } if (buffer_full_name) ptr_dict = spell_get_dict_with_buffer_name (buffer_full_name);