From 32e09a2ff52f692e63fb63c12054d8b98d60343e Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 18 Jun 2013 18:01:24 +0000 Subject: - s_serv.c: cleanup show_capabilities(). Replace sprintf() combo with strlcat() git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2281 82007160-df01-0410-b94d-b575c5fd34c7 --- src/s_serv.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/s_serv.c b/src/s_serv.c index 8594bd2..5f09a09 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -638,23 +638,22 @@ sendnick_TS(struct Client *client_p, struct Client *target_p) * side effects - build up string representing capabilities of server listed */ const char * -show_capabilities(struct Client *target_p) +show_capabilities(const struct Client *target_p) { - static char msgbuf[IRCD_BUFSIZE]; - char *t = msgbuf; - dlink_node *ptr; - - t += sprintf(msgbuf, "TS "); + static char msgbuf[IRCD_BUFSIZE] = "TS"; + const dlink_node *ptr = NULL; DLINK_FOREACH(ptr, cap_list.head) { const struct Capability *cap = ptr->data; - if (IsCapable(target_p, cap->cap)) - t += sprintf(t, "%s ", cap->name); + if (!IsCapable(target_p, cap->cap)) + continue; + + strlcat(msgbuf, " ", sizeof(msgbuf)); + strlcat(msgbuf, cap->name, sizeof(msgbuf)); } - *(t - 1) = '\0'; return msgbuf; } -- cgit