Skip to content

Commit d46057a

Browse files
committed
Escape searchterm for preg in user mail filter.
1 parent a3e2d20 commit d46057a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

interface/web/mail/mail_user_filter_edit.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ function getRule() {
129129

130130
$content .= "if (/^".$this->dataRecord["source"].":";
131131

132+
$searchterm = preg_quote($this->dataRecord["searchterm"]);
133+
132134
if($this->dataRecord["op"] == 'contains') {
133-
$content .= ".*".$this->dataRecord["searchterm"]."/:h)\n";
135+
$content .= ".*".$searchterm."/:h)\n";
134136
} elseif ($this->dataRecord["op"] == 'is') {
135-
$content .= $this->dataRecord["searchterm"]."$/:h)\n";
137+
$content .= $searchterm."$/:h)\n";
136138
} elseif ($this->dataRecord["op"] == 'begins') {
137-
$content .= $this->dataRecord["searchterm"]."/:h)\n";
139+
$content .= $searchterm."/:h)\n";
138140
} elseif ($this->dataRecord["op"] == 'ends') {
139-
$content .= ".*".$this->dataRecord["searchterm"]."$/:h)\n";
141+
$content .= ".*".$searchterm."$/:h)\n";
140142
}
141143

142144
$content .= "{\n";

0 commit comments

Comments
 (0)