Fix .cmsg crash reported by zimzum.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@62 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2009-09-02 14:14:21 +00:00
parent c0d80d4c8c
commit ef503e318e
2 changed files with 11 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2c01 ] [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 * Changed the defaults for JOIN_NEW_WINDOW_TYPE and QUERY_NEW_WINDOW_TYPE
so that they work out of the box. (caf) so that they work out of the box. (caf)

View File

@@ -657,16 +657,19 @@ int cmd_cmsg(int idx, char *par)
char *nick, *user; char *nick, *user;
SocketList *s, *s1 = NULL; SocketList *s, *s1 = NULL;
nick = LOCAL_COPY(next_arg(par, &par)); nick = next_arg(par, &par);
if ((user = strchr(nick, '@')))
*user++ = '\0';
if (nick) if (nick)
{ {
int i; int i;
if ((user = strchr(nick, '@')))
*user++ = '\0';
for (i = 0; i < get_max_fd()+1; i++) for (i = 0; i < get_max_fd()+1; i++)
{ {
if (!check_dcc_socket(i)) continue; 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; if (!s1) return TCL_OK;
s = find_dcc(nick, "chat", NULL, DCC_CHAT, 0, 1, -1); s = find_dcc(nick, "chat", NULL, DCC_CHAT, 0, 1, -1);