summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9e46dab)
raw | patch | inline | side by side (parent: 9e46dab)
author | Florian Forster <octo@collectd.org> | |
Mon, 16 Apr 2012 13:02:04 +0000 (15:02 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Mon, 16 Apr 2012 13:02:04 +0000 (15:02 +0200) |
While they are correctly encoded, e.g. as "", browsers will
complain about invalid XML and not render the page. Ignore all control
characters other than whitespace.
complain about invalid XML and not render the page. Ignore all control
characters other than whitespace.
contrib/collection3/bin/index.cgi | patch | blob | history |
index 027961fa43ac73de432e0e7435768852c423f37b..4723af964e9ecf7f6ae5a965b00855748a8adcfc 100755 (executable)
$html_started = 0;
}
+sub contains_invalid_chars
+{
+ my $str = shift;
+
+ for (split (m//, $str))
+ {
+ my $n = ord ($_);
+
+ # Whitespace is allowed.
+ if (($n >= 9) && ($n <= 13))
+ {
+ next;
+ }
+ elsif ($n < 32)
+ {
+ return (1);
+ }
+ }
+
+ return;
+}
+
sub show_selector
{
my $timespan_selection = get_timespan_selection ();
HTML
for (sort (keys %$host_selection))
{
+ next if contains_invalid_chars ($_);
my $host = encode_entities ($_);
my $selected = $host_selection->{$_}
? ' selected="selected"'
HTML
for (sort (keys %$plugin_selection))
{
+ next if contains_invalid_chars ($_);
my $plugin = encode_entities ($_);
my $selected = $plugin_selection->{$_}
? ' selected="selected"'
HTML
for (sort { $TimeSpans->{$a} <=> $TimeSpans->{$b} } (keys (%$TimeSpans)))
{
+ next if contains_invalid_chars ($_);
my $name = encode_entities ($_);
my $value = $TimeSpans->{$_};
my $selected = ($value == $timespan_selection)
for (sort @hosts)
{
my $url = encode_entities (script_name () . "?action=show_selection;hostname=$_");
+ next if contains_invalid_chars ($_);
my $name = encode_entities ($_);
print qq# <li><a href="$url">$name</a></li>\n#;
}