Merge pull request #464 from RichardHitt/bufoflo

Truncate text if too long.  Closes Issue #463
This commit is contained in:
TingPing 2013-03-23 13:21:45 -07:00
commit 8996baa35e
1 changed files with 2 additions and 0 deletions

View File

@ -1780,6 +1780,8 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig
printf ("arg[%d] is NULL in print event\n", a + 1);
} else
{
if (strlen (ar) > sizeofo - oi - 4)
ar[sizeofo - oi - 4] = 0; /* Avoid buffer overflow */
if (stripcolor_args & ARG_FLAG(a + 1)) len = strip_color2 (ar, -1, &o[oi], STRIP_ALL);
else len = strip_hidden_attribute (ar, &o[oi]);
oi += len;