aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-03-04 14:30:09 -0800
committerzotlabs <mike@macgirvin.com>2018-03-04 14:30:09 -0800
commit14f701f7fc20104520a3837c6e6c359dfa0161f7 (patch)
treefa1cfa23055a08b81941de7b13f9b844763524e2
parent471c3c4d068d1c6d4e149098d400d792fb3550a6 (diff)
downloadvolse-hubzilla-14f701f7fc20104520a3837c6e6c359dfa0161f7.tar.gz
volse-hubzilla-14f701f7fc20104520a3837c6e6c359dfa0161f7.tar.bz2
volse-hubzilla-14f701f7fc20104520a3837c6e6c359dfa0161f7.zip
restrict mail messages to max_import_size
-rwxr-xr-xinclude/items.php7
1 files changed, 7 insertions, 0 deletions
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) : '');