Cleanup ircop_flags_to_str. Make the bufsize IRCD_BUFFER_SIZE instead of

BIG_BUFFER_SIZE. Even with many flags enabled the output string shouldn't
be larger than 512 bytes. Use strlcat rather than strmcat.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@407 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-10-23 17:33:50 +00:00
parent 809dc2f727
commit 07cdd587b4

View File

@@ -1050,15 +1050,15 @@ int i, j;
char *ircop_flags_to_str(long flag)
{
int p, i;
char *buffer = new_malloc(BIG_BUFFER_SIZE+1);
int i, p;
char *buffer = new_malloc(IRCD_BUFFER_SIZE);
for (i = 0, p = 1; opflags[i]; i++, p <<= 1)
{
if (flag & p)
{
strmcat(buffer, opflags[i], BIG_BUFFER_SIZE);
strmcat(buffer, ",", BIG_BUFFER_SIZE);
strlcat(buffer, opflags[i], sizeof buffer);
strlcat(buffer, ",", sizeof buffer);
}
}
if (*buffer)