From bc4fc3b442d7e02390807c50a3b99a5790f112d6 Mon Sep 17 00:00:00 2001 From: Tobias Girstmair Date: Sat, 27 Apr 2024 12:41:31 +0200 Subject: [PATCH] defend against malformed messages if a message consists of only the prefix, we'd overrun the buffer. --- ircpipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircpipe.c b/ircpipe.c index 43b3d61..89be7ea 100644 --- a/ircpipe.c +++ b/ircpipe.c @@ -116,7 +116,7 @@ int irc_answer(const sock_t sock, char *buf, const unsigned int command) { do { /* skip over prefix (servername): */ if (line[0] == ':') - while (*line++ != ' '); /*todo: check truncation(\0)*/ + while (*line && *line++ != ' '); /* look for command responses, if any: */ switch (command) { -- 2.39.3