1
0
forked from bip/bip

Fix bip_notify usage

These may lead to crash if you call in your conf networks or other names
with %s or other fancy format strings.
This commit is contained in:
Arnaud Cornet 2009-01-06 15:58:18 +01:00
parent 217816c220
commit 41c0a5a9c6
2 changed files with 10 additions and 10 deletions

View File

@ -1379,7 +1379,7 @@ void adm_print_connection(struct link_client *ic, struct link *lnk,
noroom: /* that means the line is larger that RET_STR_LEN. We're not likely to noroom: /* that means the line is larger that RET_STR_LEN. We're not likely to
even read such a long line */ even read such a long line */
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
// TODO: on_connect_send // TODO: on_connect_send
@ -1396,13 +1396,13 @@ noroom: /* that means the line is larger that RET_STR_LEN. We're not likely to
(ch->backlog ? "" : "`")); (ch->backlog ? "" : "`"));
if (t_written > LINE_SIZE_LIM) { if (t_written > LINE_SIZE_LIM) {
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
t_written = 0; t_written = 0;
} }
} }
noroomchan: noroomchan:
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
t_written = snprintf(buf, RET_STR_LEN, " Status: "); t_written = snprintf(buf, RET_STR_LEN, " Status: ");
if (t_written >= RET_STR_LEN) if (t_written >= RET_STR_LEN)
@ -1462,7 +1462,7 @@ noroomchan:
} }
noroomstatus: noroomstatus:
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
} }
void adm_list_all_links(struct link_client *ic) void adm_list_all_links(struct link_client *ic)
@ -1521,7 +1521,7 @@ void adm_info_user(struct link_client *ic, const char *name)
noroom: noroom:
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
t_written = 0; t_written = 0;
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
@ -1590,13 +1590,13 @@ void adm_list_users(struct link_client *ic)
goto noroom; goto noroom;
if (t_written > LINE_SIZE_LIM) { if (t_written > LINE_SIZE_LIM) {
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
t_written = 0; t_written = 0;
} }
} }
noroom: noroom:
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
} }
bip_notify(ic, "-- End of User list"); bip_notify(ic, "-- End of User list");
} }
@ -1640,13 +1640,13 @@ void adm_list_networks(struct link_client *ic)
goto noroom; goto noroom;
if (t_written > LINE_SIZE_LIM) { if (t_written > LINE_SIZE_LIM) {
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
t_written = 0; t_written = 0;
} }
} }
noroom: noroom:
buf[RET_STR_LEN] = 0; buf[RET_STR_LEN] = 0;
bip_notify(ic, buf); bip_notify(ic, "%s", buf);
} }
bip_notify(ic, "-- End of Network list"); bip_notify(ic, "-- End of Network list");
} }

View File

@ -2469,7 +2469,7 @@ void irc_main(bip_t *bip)
char *l; char *l;
while ((l = list_remove_first(&bip->errors))) while ((l = list_remove_first(&bip->errors)))
bip_notify(bip->reloading_client, l); bip_notify(bip->reloading_client, "%s", l);
bip->reloading_client = NULL; bip->reloading_client = NULL;
} }