Fixed a few null pointer derefs caused by dummy code that somehow I

forgot about.
This commit is contained in:
Diogo Sousa 2013-06-23 21:31:09 +01:00
parent ce6fef3d0a
commit aef9e3922e

View File

@ -2707,7 +2707,6 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[])
char *nick = word[2]; char *nick = word[2];
char *msg = word_eol[3]; char *msg = word_eol[3];
struct session *newsess; struct session *newsess;
char *split_text = NULL; char *split_text = NULL;
int cmd_length = 13; /* " PRIVMSG ", " ", :, \r, \n */ int cmd_length = 13; /* " PRIVMSG ", " ", :, \r, \n */
int offset = 0; int offset = 0;
@ -2758,10 +2757,13 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[])
newsess = find_channel (sess->server, nick); newsess = find_channel (sess->server, nick);
if (newsess) if (newsess)
{ {
message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
while ((split_text = split_up_text (sess, msg + offset, cmd_length, split_text))) while ((split_text = split_up_text (sess, msg + offset, cmd_length, split_text)))
{ {
inbound_chanmsg (newsess->server, NULL, newsess->channel, inbound_chanmsg (newsess->server, NULL, newsess->channel,
newsess->server->nick, split_text, TRUE, FALSE, 0); newsess->server->nick, split_text, TRUE, FALSE,
&no_tags);
if (*split_text) if (*split_text)
offset += strlen(split_text); offset += strlen(split_text);
@ -2769,7 +2771,8 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[])
g_free(split_text); g_free(split_text);
} }
inbound_chanmsg (newsess->server, NULL, newsess->channel, inbound_chanmsg (newsess->server, NULL, newsess->channel,
newsess->server->nick, msg + offset, TRUE, FALSE, 0); newsess->server->nick, msg + offset, TRUE, FALSE,
&no_tags);
} }
else else
{ {
@ -3712,8 +3715,11 @@ cmd_wallchan (struct session *sess, char *tbuf, char *word[],
sess = list->data; sess = list->data;
if (sess->type == SESS_CHANNEL) if (sess->type == SESS_CHANNEL)
{ {
message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
inbound_chanmsg (sess->server, NULL, sess->channel, inbound_chanmsg (sess->server, NULL, sess->channel,
sess->server->nick, word_eol[2], TRUE, FALSE, 0); sess->server->nick, word_eol[2], TRUE, FALSE,
&no_tags);
sess->server->p_message (sess->server, sess->channel, word_eol[2]); sess->server->p_message (sess->server, sess->channel, word_eol[2]);
} }
list = list->next; list = list->next;
@ -4357,6 +4363,7 @@ handle_say (session *sess, char *text, int check_spch)
char *newcmd = newcmd_static; char *newcmd = newcmd_static;
int len; int len;
int newcmdlen = sizeof newcmd_static; int newcmdlen = sizeof newcmd_static;
message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
if (strcmp (sess->channel, "(lastlog)") == 0) if (strcmp (sess->channel, "(lastlog)") == 0)
{ {
@ -4409,7 +4416,7 @@ handle_say (session *sess, char *text, int check_spch)
if (dcc) if (dcc)
{ {
inbound_chanmsg (sess->server, NULL, sess->channel, inbound_chanmsg (sess->server, NULL, sess->channel,
sess->server->nick, text, TRUE, FALSE, 0); sess->server->nick, text, TRUE, FALSE, &no_tags);
set_topic (sess, net_ip (dcc->addr), net_ip (dcc->addr)); set_topic (sess, net_ip (dcc->addr), net_ip (dcc->addr));
goto xit; goto xit;
} }
@ -4424,7 +4431,7 @@ handle_say (session *sess, char *text, int check_spch)
while ((split_text = split_up_text (sess, text + offset, cmd_length, split_text))) while ((split_text = split_up_text (sess, text + offset, cmd_length, split_text)))
{ {
inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick, inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick,
split_text, TRUE, FALSE, 0); split_text, TRUE, FALSE, &no_tags);
sess->server->p_message (sess->server, sess->channel, split_text); sess->server->p_message (sess->server, sess->channel, split_text);
if (*split_text) if (*split_text)
@ -4434,7 +4441,7 @@ handle_say (session *sess, char *text, int check_spch)
} }
inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick, inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick,
text + offset, TRUE, FALSE, 0); text + offset, TRUE, FALSE, &no_tags);
sess->server->p_message (sess->server, sess->channel, text + offset); sess->server->p_message (sess->server, sess->channel, text + offset);
} else } else
{ {