Cast $needle in calls to strpos/stripos to string to avoid automatic ordinal conversion of integer patterns

This commit is contained in:
Elliot Kendall
2022-07-25 09:52:27 -07:00
parent 29e6c73558
commit 77ebd8abd7

View File

@@ -709,14 +709,14 @@ class MalwareScanner
//Returns true if the raw string exists in the file contents. //Returns true if the raw string exists in the file contents.
private function scanFunc_STR(&$pattern, &$content) private function scanFunc_STR(&$pattern, &$content)
{ {
return strpos($content, $pattern); return strpos($content, (string)$pattern);
} }
//Performs raw string, case insensitive matching. //Performs raw string, case insensitive matching.
//Returns true if the raw string exists in the file contents, ignoring case. //Returns true if the raw string exists in the file contents, ignoring case.
private function scanFunc_STRI(&$pattern, &$content) private function scanFunc_STRI(&$pattern, &$content)
{ {
return stripos($content, $pattern); return stripos($content, (string)$pattern);
} }
//Performs regular expression matching. //Performs regular expression matching.