diff options
author | TingPing <tngpng@gmail.com> | 2013-03-23 13:21:45 -0700 |
---|---|---|
committer | TingPing <tngpng@gmail.com> | 2013-03-23 13:21:45 -0700 |
commit | 8996baa35ee12556a7bf402e3568193dbafec5f1 (patch) | |
tree | 8701966c6549ce6e42757028b66aee2513aba648 /src | |
parent | c99e7f8154326a1106c0faffe412097e3dfd663f (diff) | |
parent | f7923f2a02452153614e17143b8e82bec4475ad7 (diff) |
Merge pull request #464 from RichardHitt/bufoflo
Truncate text if too long. Closes Issue #463
Diffstat (limited to 'src')
-rw-r--r-- | src/common/text.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/text.c b/src/common/text.c index 5c4fb3ca..33ef3c9e 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -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; |