From 44874b28b3ed26ae3a49625ea6df42720b8a8c06 Mon Sep 17 00:00:00 2001 From: Tim Cava Date: Sun, 13 Oct 2013 18:33:23 +0000 Subject: [PATCH] Cleanup l_help() a little bit. Use strlcat and strlcpy rather than strmcat and sprintf. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@383 13b04d17-f746-0410-82c6-800466cd88b0 --- source/cdcc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/cdcc.c b/source/cdcc.c index 06f62c4..223f44b 100644 --- a/source/cdcc.c +++ b/source/cdcc.c @@ -241,16 +241,17 @@ BUILT_IN_COMMAND(cdcc) static int l_help(char *cmd, char *args) { -int i; -char buffer[BIG_BUFFER_SIZE+1]; + int i; + char buffer[BIG_BUFFER_SIZE]; + if (!cmd) { int c = 0; *buffer = 0; for (i = 0; *local[i].name; i++) { - strmcat(buffer, local[i].name, BIG_BUFFER_SIZE); - strmcat(buffer, space, BIG_BUFFER_SIZE); + strlcat(buffer, local[i].name, sizeof buffer); + strlcat(buffer, space, sizeof buffer); if (++c == 5) { put_it("%s", convert_output_format("$G $[13]0 $[13]1 $[13]2 $[13]3 $[13]4", "%s", buffer)); @@ -269,7 +270,8 @@ char buffer[BIG_BUFFER_SIZE+1]; { if (my_stricmp(local[i].name, cmd)) continue; - sprintf(buffer, "CDCC %s", cmd); + strlcpy(buffer, "CDCC ", sizeof buffer); + strlcat(buffer, cmd, sizeof buffer); userage(buffer, local[i].help?local[i].help:" - No help available"); done++; }