Skip to content

Commit

Permalink
- add a max setting for cgi image size. (D: Closes #670811)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveschnepp committed Apr 30, 2012
1 parent ce3b8c6 commit 26fbc97
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions common/lib/Munin/Common/Config.pm
Expand Up @@ -39,6 +39,7 @@ my %legal = map { $_ => 1 } (
"unknown_limit", "num_unknowns", "dropdownlimit",
"max_graph_jobs", "max_cgi_graph_jobs", "munin_cgi_graph_jobs",
"max_html_jobs", "cgitmpdir", "update_rate",
"max_size_x", "max_size_y",
"staticdir", "html_strategy",
"rrdcached_socket", "graph_args_after",
"graph_future", "trend", "predict",
Expand Down
17 changes: 17 additions & 0 deletions master/_bin/munin-cgi-graph.in
Expand Up @@ -355,6 +355,23 @@ sub verify_parameters {
return 0;
}
}

# Checks the image size requested.
if (( CGI::param("size_x") || "") =~ m/^(\d+)/) {
my $max_size_x = ( $config->{max_size_x} || 4000);
if ($1 > $max_size_x) {
WARN "[WARNING] Asked image size x too large : $1 > $max_size_x. Bailing out.";
return 0;
}
}
if (( CGI::param("size_y") || "") =~ m/^(\d+)/) {
my $max_size_y = ($config->{max_size_y} || 4000);
if ($1 > $max_size_y) {
WARN "[WARNING] Asked image size y too large : $1 > $max_size_y. Bailing out.";
return 0;
}
}

return 1;
}

Expand Down

0 comments on commit 26fbc97

Please sign in to comment.