mirror of
https://github.com/pi-hole/web.git
synced 2026-04-22 01:39:50 +01:00
Limit max length for a domain entry to 253 chars when importing from teleoprter archives, skip longer entries without importing them.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -116,13 +116,18 @@ function archive_restore_table($file, $table, $flush=false)
|
||||
$num = 0;
|
||||
foreach($contents as $row)
|
||||
{
|
||||
if($table === "adlist")
|
||||
$line = "address";
|
||||
else
|
||||
$line = "domain";
|
||||
|
||||
// Limit max length for a domain entry to 253 chars
|
||||
if(strlen($row[$line]) > 253)
|
||||
continue;
|
||||
|
||||
$stmt->bindValue(":id", $row["id"], SQLITE3_INTEGER);
|
||||
$stmt->bindValue(":date_added", $row["date_added"], SQLITE3_INTEGER);
|
||||
|
||||
if($table === "adlist")
|
||||
$stmt->bindValue(":address", $row["address"], SQLITE3_TEXT);
|
||||
else
|
||||
$stmt->bindValue(":domain", $row["domain"], SQLITE3_TEXT);
|
||||
$stmt->bindValue(":".$line, $row[$line], SQLITE3_TEXT);
|
||||
|
||||
if($table !== "domain_audit")
|
||||
{
|
||||
@@ -205,6 +210,10 @@ function archive_insert_into_table($file, $table, $flush=false, $wildcardstyle=f
|
||||
else
|
||||
$line = $row;
|
||||
|
||||
// Limit max length for a domain entry to 253 chars
|
||||
if(strlen($line) > 253)
|
||||
continue;
|
||||
|
||||
if($table === "adlist")
|
||||
$stmt->bindValue(":address", $line, SQLITE3_TEXT);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user