bans.php: limit post body length to 12 KBs

This commit is contained in:
Zankaria 2024-08-19 22:54:05 +02:00
parent a6040e704b
commit 31086b05d9

View file

@ -455,11 +455,11 @@ class Bans {
$post['board'] = $board['uri']; $post['board'] = $board['uri'];
/* /*
* The body can be so long to make the json longer than 64KBs, causing the query to fail. * The body can be so long to make the json longer than 64KBs, causing the query to fail.
* Truncate it to a safe length (32KBs). It could probably be longer, but if the deleted body is THAT big * Truncate it to a safe length (12KBs). It could probably be longer, but if the deleted body is THAT big
* already, the likelihood of it being just assorted spam/garbage is about 101%. * already, the likelihood of it being just assorted spam/garbage is about 101%.
*/ */
// We're on UTF-8 only, right...? // We're on UTF-8 only, right...?
$post['body'] = mb_strcut($post['body'], 0, 32768); $post['body'] = mb_strcut($post['body'], 0, 12288);
$query->bindValue(':post', json_encode($post)); $query->bindValue(':post', json_encode($post));
} else { } else {