Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
phpipam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
phpipam
Commits
e06cd55b
Unverified
Commit
e06cd55b
authored
Jul 5, 2021
by
Gary Allan
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix: Allow UTF-8 in user instructions. Fixes #3360
parent
025762fb
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
functions/classes/class.Common.php
+31
-24
31 additions, 24 deletions
functions/classes/class.Common.php
misc/CHANGELOG
+1
-1
1 addition, 1 deletion
misc/CHANGELOG
with
32 additions
and
25 deletions
functions/classes/class.Common.php
+
31
−
24
View file @
e06cd55b
...
@@ -640,6 +640,12 @@ class Common_functions {
...
@@ -640,6 +640,12 @@ class Common_functions {
if
(
!
is_string
(
$html
)
||
strlen
(
$html
)
==
0
)
if
(
!
is_string
(
$html
)
||
strlen
(
$html
)
==
0
)
return
""
;
return
""
;
// Convert encoding to UTF-8
$html
=
mb_convert_encoding
(
$html
,
'HTML-ENTITIES'
,
'UTF-8'
);
// Throw loadHTML() parsing errors
$err_mode
=
libxml_use_internal_errors
(
false
);
try
{
try
{
$dom
=
new
\DOMDocument
();
$dom
=
new
\DOMDocument
();
...
@@ -651,9 +657,7 @@ class Common_functions {
...
@@ -651,9 +657,7 @@ class Common_functions {
$elements
=
$dom
->
getElementsByTagName
(
'*'
);
$elements
=
$dom
->
getElementsByTagName
(
'*'
);
if
(
!
is_object
(
$elements
)
||
$elements
->
length
==
0
)
if
(
is_object
(
$elements
)
&&
$elements
->
length
>
0
)
{
return
$html
;
// no HTML elements
foreach
(
$elements
as
$e
)
{
foreach
(
$elements
as
$e
)
{
if
(
in_array
(
$e
->
nodeName
,
$banned_elements
))
{
if
(
in_array
(
$e
->
nodeName
,
$banned_elements
))
{
$remove_elements
[]
=
$e
;
$remove_elements
[]
=
$e
;
...
@@ -676,12 +680,15 @@ class Common_functions {
...
@@ -676,12 +680,15 @@ class Common_functions {
// Return sanitised HTML
// Return sanitised HTML
$html
=
$dom
->
saveHTML
();
$html
=
$dom
->
saveHTML
();
}
return
is_string
(
$html
)
?
$html
:
""
;
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
return
""
;
$html
=
""
;
}
}
// restore error mode
libxml_use_internal_errors
(
$err_mode
);
return
is_string
(
$html
)
?
$html
:
""
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
misc/CHANGELOG
+
1
−
1
View file @
e06cd55b
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
+ SQL injections processing `ftype` (#2751);
+ SQL injections processing `ftype` (#2751);
+ All circuits map, PHP object injection (#2937);
+ All circuits map, PHP object injection (#2937);
+ Upgraded jQuery to 3.5.1 (#3119);
+ Upgraded jQuery to 3.5.1 (#3119);
+ Stored XSS in instructions widgets (#3025);
+ Stored XSS in instructions widgets (#3025
, #3360
);
+ PHP session ID fixation (#3342);
+ PHP session ID fixation (#3342);
+ XSS (reflected) in IP calculator (#3351);
+ XSS (reflected) in IP calculator (#3351);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment