From f2aef8c13ca9f31a2cde75c8c566d077ccebc2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 26 Jan 2022 20:24:31 +0100 Subject: [PATCH] core: check that utf_char is not NULL in gui chat functions --- src/gui/gui-chat.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 7620a6344..e8838b72c 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -138,6 +138,9 @@ gui_chat_prefix_build () int gui_chat_utf_char_valid (const char *utf_char) { + if (!utf_char) + return 0; + /* chars below 32 are not valid (except TAB) */ if (((unsigned char)utf_char[0] < 32) && (utf_char[0] != '\t')) return 0; @@ -159,6 +162,9 @@ gui_chat_utf_char_valid (const char *utf_char) int gui_chat_char_size_screen (const char *utf_char) { + if (!utf_char) + return 0; + /* if char is invalid, it will be displayed as one space on screen */ if (!gui_chat_utf_char_valid (utf_char)) return 1;