From 240aeac4d369df97d0e4ee54bd2924afe75258c8 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 25 Feb 2020 14:55:46 +0100 Subject: Make cmd_logging() safer Could be that args[1] is not set. --- src/command/cmd_funcs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 93b37c30..5395a53e 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -6714,7 +6714,8 @@ cmd_logging(ProfWin *window, const char *const command, gchar **args) return TRUE; } - if (strcmp(args[0], "chat") == 0) { + + if (strcmp(args[0], "chat") == 0 && args[1] != NULL) { _cmd_set_boolean_preference(args[1], command, "Chat logging", PREF_CHLOG); // if set to off, disable history @@ -6723,7 +6724,7 @@ cmd_logging(ProfWin *window, const char *const command, gchar **args) } return TRUE; - } else if (g_strcmp0(args[0], "group") == 0) { + } else if (g_strcmp0(args[0], "group") == 0 && args[1] != NULL) { if (g_strcmp0(args[1], "on") == 0 || g_strcmp0(args[1], "off") == 0) { _cmd_set_boolean_preference(args[1], command, "Groupchat logging", PREF_GRLOG); return TRUE; -- cgit 1.4.1-2-gfad0