Skip to content

Commit

Permalink
fix: use preg_quote to properly escape domain
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondas committed Dec 2, 2023
1 parent ecda6cb commit 911ac98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ZoneTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ public static function add_zone_templ_save_as($db, $db_type, string $template_na
}

foreach ($records as $record) {
$name = $domain ? preg_replace('/' . $domain . '/', '[ZONE]', $record['name']) : $record['name'];
$content = $domain ? preg_replace('/' . $domain . '/', '[ZONE]', $record['content']) : $record['content'];
$name = $domain ? preg_replace('/' . preg_quote($domain, '/') . '/', '[ZONE]', $record['name']) : $record['name'];
$content = $domain ? preg_replace('/' . preg_quote($domain, '/') . '/', '[ZONE]', $record['content']) : $record['content'];

$query2 = "INSERT INTO zone_templ_records (zone_templ_id, name, type, content, ttl, prio) VALUES ("
. $db->quote($zone_templ_id, 'integer') . ","
Expand Down

0 comments on commit 911ac98

Please sign in to comment.