diff options
-rw-r--r-- | Bugzilla/Util.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index a8ba2d81c..982e34c93 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -201,6 +201,16 @@ sub xml_quote { $var =~ s/>/\>/g; $var =~ s/\"/\"/g; $var =~ s/\'/\'/g; + + # the following nukes characters disallowed by the XML 1.0 + # spec, Production 2.2. 1.0 declares that only the following + # are valid: + # (#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]) + $var =~ s/([\x{0001}-\x{0008}]| + [\x{000B}-\x{000C}]| + [\x{000E}-\x{0019}]| + [\x{D800}-\x{DFFF}]| + [\x{FFFE}-\x{FFFF}])//gx; return $var; } |