diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-09 14:24:52 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-09 14:25:41 +0100 |
commit | a0a11fb9957834effc3da06bf4f22f690e8df573 (patch) | |
tree | 95410524d38b7937a3ed5484bb3c36703c5bf043 /src/libserver/task.c | |
parent | 23ca253834bd07e3407f91f319f23cce4c9c58f1 (diff) | |
download | rspamd-a0a11fb9957834effc3da06bf4f22f690e8df573.tar.gz rspamd-a0a11fb9957834effc3da06bf4f22f690e8df573.zip |
[Feature] Add some sanity check for very long from/to log elements
Diffstat (limited to 'src/libserver/task.c')
-rw-r--r-- | src/libserver/task.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c index 95e435b6e..47e9aa1c5 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -1025,7 +1025,7 @@ rspamd_task_write_ialist (struct rspamd_task *task, rspamd_ftok_t var = {.begin = NULL, .len = 0}; InternetAddressMailbox *iamb; InternetAddress *ia = NULL; - gint i; + gint i, nchars = 0, cur_chars; if (lim <= 0) { lim = internet_address_list_length (ialist); @@ -1039,8 +1039,10 @@ rspamd_task_write_ialist (struct rspamd_task *task, if (ia && INTERNET_ADDRESS_IS_MAILBOX (ia)) { iamb = INTERNET_ADDRESS_MAILBOX (ia); + cur_chars = strlen (iamb->addr); varbuf = rspamd_fstring_append (varbuf, iamb->addr, - strlen (iamb->addr)); + cur_chars); + nchars += cur_chars; } if (varbuf->len > 0) { @@ -1049,7 +1051,7 @@ rspamd_task_write_ialist (struct rspamd_task *task, } } - if (i >= max_log_elts) { + if (i >= max_log_elts || nchars >= max_log_elts * 10) { varbuf = rspamd_fstring_append (varbuf, "...", 3); break; } |