From e66d0c4a740bca0e6ab2182e0a2f92e44964accb Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 7 Aug 2019 22:25:17 +0200 Subject: [PATCH] Limit maximum length of each domain to 253 characters. We should document this somewhere if power users want to add insanely long regex filters, they will have to do this by directly interacting with the database. Signed-off-by: DL6ER --- scripts/pi-hole/php/database.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/pi-hole/php/database.php b/scripts/pi-hole/php/database.php index 319a3260..d3ac258b 100644 --- a/scripts/pi-hole/php/database.php +++ b/scripts/pi-hole/php/database.php @@ -89,6 +89,10 @@ function add_to_table($db, $table, $domains, $wildcardstyle=false, $returnnum=fa $num = 0; foreach($domains as $domain) { + // Limit max length for a domain entry to 253 chars + if(strlen($domain) > 253) + continue; + if($wildcardstyle) $domain = "(\\.|^)".str_replace(".","\\.",$domain)."$";