From fdb83238deb3fa63745976e7d9d8f7fa7feb8618 Mon Sep 17 00:00:00 2001 From: Tim Cava Date: Sat, 26 Oct 2013 02:28:13 +0000 Subject: [PATCH] Cleanup stat_convert_format() a little bit. Use strlcat rather than strmcat. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@413 13b04d17-f746-0410-82c6-800466cd88b0 --- source/status.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/source/status.c b/source/status.c index 49fa8a5..490cb5a 100644 --- a/source/status.c +++ b/source/status.c @@ -555,18 +555,14 @@ int in_rhs = 0, char *stat_convert_format(Window *win, char *form) { -unsigned char buffer[2 * BIG_BUFFER_SIZE + 1]; - char *ptr = form; - int pos = 0; - int map; - char key; - int i; - + int map, key, i, pos = 0; + char *ptr = form; + unsigned char buffer[2 * BIG_BUFFER_SIZE + 1]; if (!form || !*form) return m_strdup(empty_string); - *buffer = 0; + *buffer = 0; while (*ptr && pos < (2 * BIG_BUFFER_SIZE) - 4) { if (*ptr != '%') @@ -600,7 +596,7 @@ unsigned char buffer[2 * BIG_BUFFER_SIZE + 1]; { if (status_expandos[i].map != map || status_expandos[i].key != key) continue; - strmcat(buffer, (status_expandos[i].callback_function)(win), BIG_BUFFER_SIZE); + strlcat(buffer, status_expandos[i].callback_function(win), sizeof buffer); pos = strlen(buffer); break; }