From d15a738ee9d995d702e1fa6b42b19e737299b9c5 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sat, 6 Jan 2018 21:20:48 +1100 Subject: [PATCH] Don't limit dcc_schat_input to DCC_CHAT type (which is never true) --- dll/arcfour/arcfour.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dll/arcfour/arcfour.c b/dll/arcfour/arcfour.c index de49c54..1767b83 100644 --- a/dll/arcfour/arcfour.c +++ b/dll/arcfour/arcfour.c @@ -163,15 +163,17 @@ static int send_dcc_encrypt (int type, int sock, char *buf, int len) return -1; } -static int dcc_schat_input (int type, int sock, char *buf, int parm, int len) +static int dcc_schat_input(int type, int sock, char *buf, int parm, int buf_size) { - if (type == DCC_CHAT) { - if ((len = dgets(buf, sock, parm, BIG_BUFFER_SIZE, NULL)) > 0) { - buf[len-1] = '\0'; - dcc_crypt(sock, buf, len); - if (buf[len]) - buf[len] = '\0'; - } + int len; + + len = dgets(buf, sock, parm, buf_size - 1, NULL); + + if (len > 0) + { + buf[len-1] = '\0'; + dcc_crypt(sock, buf, len); + buf[len] = '\0'; } return len; }