Safer display in chat

This commit is contained in:
Michiel Broek
2006-03-06 20:30:09 +00:00
parent 49a8f5ed69
commit fa036b00b7
3 changed files with 16 additions and 7 deletions

View File

@@ -508,7 +508,7 @@ void chat_close_r(char *data, char *buf)
void chat_put_r(char *data, char *buf)
{
char *p, *pid, *msg, *cmd, *mbuf, *flags, temp[81];
char *p, *q, *pid, *msg, *cmd, *mbuf, *flags, temp[81];
int first, count, owner = FALSE, found;
usr_list *tmpu, *tmp;
chn_list *tmpc;
@@ -588,8 +588,13 @@ void chat_put_r(char *data, char *buf)
system_msg(tmpu->pid, mbuf);
}
first = FALSE;
snprintf(mbuf, 200, "%3d %-20s %-54s", tmpc->users, tmpc->name, tmpc->topic);
system_msg(tmpu->pid, mbuf);
q = calloc(81, sizeof(char));
snprintf(q, 81, "%3d %-20s ", tmpc->users, tmpc->name);
p = xstrcpy(q);
p = xstrcat(p, tmpc->topic);
system_msg(tmpu->pid, p);
free(p);
free(q);
}
if (first) {
snprintf(mbuf, 200, "No active channels to list");