From 77a8a2b9ac999eede28169420fb44ada95fa4644 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 4 Mar 2018 14:30:09 -0800 Subject: restrict mail messages to max_import_size --- include/items.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/items.php b/include/items.php index 790b91c88..50f663836 100755 --- a/include/items.php +++ b/include/items.php @@ -1412,6 +1412,13 @@ function get_mail_elements($x) { } else { $arr['body'] = (($x['body']) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8',false) : ''); + + $maxlen = get_max_import_size(); + + if($maxlen && mb_strlen($arr['body']) > $maxlen) { + $arr['body'] = mb_substr($arr['body'],0,$maxlen,'UTF-8'); + logger('message length exceeds max_import_size: truncated'); + } } $arr['title'] = (($x['title'])? htmlspecialchars($x['title'],ENT_COMPAT,'UTF-8',false) : ''); -- cgit v1.2.3