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
This commit is contained in:
Tim Cava
2013-10-13 18:33:23 +00:00
parent 3de05c07c1
commit 44874b28b3

View File

@@ -242,15 +242,16 @@ BUILT_IN_COMMAND(cdcc)
static int l_help(char *cmd, char *args) static int l_help(char *cmd, char *args)
{ {
int i; int i;
char buffer[BIG_BUFFER_SIZE+1]; char buffer[BIG_BUFFER_SIZE];
if (!cmd) if (!cmd)
{ {
int c = 0; int c = 0;
*buffer = 0; *buffer = 0;
for (i = 0; *local[i].name; i++) for (i = 0; *local[i].name; i++)
{ {
strmcat(buffer, local[i].name, BIG_BUFFER_SIZE); strlcat(buffer, local[i].name, sizeof buffer);
strmcat(buffer, space, BIG_BUFFER_SIZE); strlcat(buffer, space, sizeof buffer);
if (++c == 5) if (++c == 5)
{ {
put_it("%s", convert_output_format("$G $[13]0 $[13]1 $[13]2 $[13]3 $[13]4", "%s", buffer)); 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)) if (my_stricmp(local[i].name, cmd))
continue; 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"); userage(buffer, local[i].help?local[i].help:" - No help available");
done++; done++;
} }