From b12e865b9b1b4ffd2432d46a1e8cc450757a82f6 Mon Sep 17 00:00:00 2001 From: Tim Cava Date: Wed, 23 Oct 2013 14:48:45 +0000 Subject: [PATCH] Cleanup bits_to_lastlog_level a little bit. Use strlcat rather than strmcat. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@405 13b04d17-f746-0410-82c6-800466cd88b0 --- source/lastlog.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source/lastlog.c b/source/lastlog.c index 3798f2a..e5de6c4 100644 --- a/source/lastlog.c +++ b/source/lastlog.c @@ -87,9 +87,9 @@ unsigned long BX_set_lastlog_msg_level(unsigned long level) */ char * bits_to_lastlog_level(unsigned long level) { - static char buffer[481]; /* this *should* be enough for this */ - int i; -unsigned long p; + int i; + unsigned long p; + static char buffer[512]; if (level == LOG_ALL) strcpy(buffer, "ALL"); @@ -97,14 +97,13 @@ unsigned long p; strcpy(buffer, "NONE"); else { - *buffer = '\0'; - for (i = 0, p = 1; i < NUMBER_OF_LEVELS; i++, p <<= 1) + for (*buffer = i = 0, p = 1; i < NUMBER_OF_LEVELS; i++, p <<= 1) { if (level & p) { if (*buffer) - strmcat(buffer, space, 480); - strmcat(buffer, levels[i],480); + strlcat(buffer, space, sizeof buffer); + strlcat(buffer, levels[i], sizeof buffer); } } }