commit cfb3464c6e64618ff106babb98ccddb258b2fec5
parent d9be11ad05a8d60dc1aee3c7e7f872625641314d
Author: Christoph Lohmann <20h@r-36.net>
Date: Thu, 23 Dec 2021 22:11:08 +0100
Reduce effective buffer size per channel input.
This will curb the easy way to trigger a too long line sent to the
server and prevent this error and connection drop.
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/ii.c b/ii.c
@@ -683,7 +683,14 @@ read_line(int fd, char *buf, size_t bufsiz)
static void
handle_channels_input(int ircfd, Channel *c)
{
- char buf[IRC_MSG_MAX];
+ /*
+ * Do not allow to read this fully, since commands will be
+ * prepended. It will result in too long lines sent to the
+ * server.
+ * TODO: Make this depend on the maximum metadata given by the
+ * server at the beginning of the connection.
+ */
+ char buf[IRC_MSG_MAX-64];
if (read_line(c->fdin, buf, sizeof(buf)) == -1) {
if (channel_reopen(c) == -1)