From 700c579ee78c0ffa8b8b0fca14d55f243d28c4c2 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 6 Nov 2021 13:27:45 +0100 Subject: [PATCH] Fix possible crash in set::part-instead-of-quit-on-comment-change. --- src/modules/quit.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/quit.c b/src/modules/quit.c index 579116ed8..4bddef2a9 100644 --- a/src/modules/quit.c +++ b/src/modules/quit.c @@ -130,12 +130,17 @@ CMD_FUNC(cmd_quit) char tmp[512]; int ret; - strlcpy(tmp, newcomment, sizeof(tmp)); parx[0] = NULL; parx[1] = channel->name; - parx[2] = tmp; - parx[3] = NULL; + if (newcomment) + { + strlcpy(tmp, newcomment, sizeof(tmp)); + parx[2] = tmp; + parx[3] = NULL; + } else { + parx[2] = NULL; + } do_cmd(client, recv_mtags, "PART", newcomment ? 3 : 2, parx); /* This would be unusual, but possible (somewhere in the future perhaps): */