From ef503e318e41292931bc3433a97af81c7995bee1 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Wed, 2 Sep 2009 14:14:21 +0000 Subject: [PATCH] Fix .cmsg crash reported by zimzum. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@62 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 2 ++ source/bot_link.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index e7e3639..73bd04c 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01 ] +* [1.1s01] Fixed .cmsg crash reported by zimzum. (caf) + * Changed the defaults for JOIN_NEW_WINDOW_TYPE and QUERY_NEW_WINDOW_TYPE so that they work out of the box. (caf) diff --git a/source/bot_link.c b/source/bot_link.c index 53a7b4f..53419a7 100644 --- a/source/bot_link.c +++ b/source/bot_link.c @@ -654,19 +654,22 @@ SocketList *s; int cmd_cmsg(int idx, char *par) { -char *nick, *user; -SocketList *s, *s1 = NULL; + char *nick, *user; + SocketList *s, *s1 = NULL; + + nick = next_arg(par, &par); - nick = LOCAL_COPY(next_arg(par, &par)); - if ((user = strchr(nick, '@'))) - *user++ = '\0'; if (nick) { int i; + + if ((user = strchr(nick, '@'))) + *user++ = '\0'; + for (i = 0; i < get_max_fd()+1; i++) { if (!check_dcc_socket(i)) continue; - if (idx == i) { s1 = get_socketinfo(i); break; } + if (idx == i) { s1 = get_socket(i); break; } } if (!s1) return TCL_OK; s = find_dcc(nick, "chat", NULL, DCC_CHAT, 0, 1, -1);