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

@@ -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);