From 409f67cfa37fcc84ddff5df3ac6cff8ac1fb7b5b Mon Sep 17 00:00:00 2001 From: Dimitrios Liapis Date: Sat, 12 Nov 2022 23:48:17 +0200 Subject: [PATCH] escape chars --- .gitignore | 1 + src/DetectCMS/Thirdparty/simple_html_dom.php | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..757fee3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea \ No newline at end of file diff --git a/src/DetectCMS/Thirdparty/simple_html_dom.php b/src/DetectCMS/Thirdparty/simple_html_dom.php index 9a7b2f6..bddac00 100644 --- a/src/DetectCMS/Thirdparty/simple_html_dom.php +++ b/src/DetectCMS/Thirdparty/simple_html_dom.php @@ -680,7 +680,7 @@ protected function parse_selector($selector_string) { // This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression. // farther study is required to determine of this should be documented or removed. // $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; - $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; + $pattern = "/([\w\-:\*]*)(?:\#([\w\-]+)|\.([\w\-]+))?(?:\[@?(!?[\w\-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER); if (is_object($debugObject)) {$debugObject->debugLog(2, "Matches Array: ", $matches);} @@ -808,11 +808,11 @@ function convert_text($text) } /** - * Returns true if $string is valid UTF-8 and false otherwise. - * - * @param mixed $str String to be tested - * @return boolean - */ + * Returns true if $string is valid UTF-8 and false otherwise. + * + * @param mixed $str String to be tested + * @return boolean + */ static function is_utf8($str) { $c=0; $b=0; @@ -888,7 +888,7 @@ function get_display_size() $attributes = array(); preg_match_all("/([\w-]+)\s*:\s*([^;]+)\s*;?/", $this->attr['style'], $matches, PREG_SET_ORDER); foreach ($matches as $match) { - $attributes[$match[1]] = $match[2]; + $attributes[$match[1]] = $match[2]; } // If there is a width in the style attributes: @@ -934,7 +934,7 @@ function get_display_size() // If the class or id is specified in a SEPARATE css file thats not on the page, go get it and do what we were just doing for the ones on the page. $result = array('height' => $height, - 'width' => $width); + 'width' => $width); return $result; } @@ -1009,7 +1009,7 @@ class simple_html_dom 'p'=>array('p'=>1), 'nobr'=>array('nobr'=>1), 'b'=>array('b'=>1), - 'option'=>array('option'=>1), + 'option'=>array('option'=>1), ); function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) @@ -1361,7 +1361,7 @@ protected function read_tag() return true; } - if (!preg_match("/^[\w-:]+$/", $tag)) { + if (!preg_match("/^[\w\-:]+$/", $tag)) { $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>'); if ($this->char==='<') { $this->link_nodes($node, false);