1 --- cacti-0.8.7e/graph.php 2009-06-28 12:07:11.000000000 -0400
2 +++ cacti-0.8.7e-patched/graph.php 2009-11-21 23:10:16.000000000 -0500
4 /* ================= input validation ================= */
5 input_validate_input_regex(get_request_var_request("rra_id"), "^([0-9]+|all)$");
6 input_validate_input_number(get_request_var("local_graph_id"));
7 +input_validate_input_number(get_request_var("graph_end"));
8 +input_validate_input_number(get_request_var("graph_start"));
9 input_validate_input_regex(get_request_var_request("view_type"), "^([a-zA-Z0-9]+)$");
10 /* ==================================================== */
12 --- cacti-0.8.7e/include/top_graph_header.php 2009-06-28 12:07:11.000000000 -0400
13 +++ cacti-0.8.7e-patched/include/top_graph_header.php 2009-11-21 23:15:27.000000000 -0500
15 if ($_SESSION["custom"]) {
16 print "<meta http-equiv=refresh content='99999'>\r\n";
18 - print "<meta http-equiv=refresh content='" . read_graph_config_option("page_refresh") . "'>\r\n";
19 + print "<meta http-equiv=refresh content='" . htmlspecialchars(read_graph_config_option("page_refresh"),ENT_QUOTES) . "'>\r\n";
26 <td bgcolor="#efefef" colspan="1" height="8" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
27 - <img src="images/transparent_line.gif" width="<?php print read_graph_config_option("default_dual_pane_width");?>" height="2" border="0"><br>
28 + <img src="images/transparent_line.gif" width="<?php print htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>" height="2" border="0"><br>
30 <td bgcolor="#ffffff" colspan="1" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;">
35 <?php if ((read_graph_config_option("default_tree_view_mode") == "2") && (($_REQUEST["action"] == "tree") || ((isset($_REQUEST["view_type"]) ? $_REQUEST["view_type"] : "") == "tree"))) { ?>
36 - <td valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;" bgcolor='#efefef' width='<?php print read_graph_config_option("default_dual_pane_width");?>' class='noprint'>
37 + <td valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;" bgcolor='#efefef' width='<?php print htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>' class='noprint'>
38 <table border=0 cellpadding=0 cellspacing=0><tr><td><font size=-2><a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></font></td></tr></table>
39 <?php grow_dhtml_trees(); ?>
40 <script type="text/javascript">initializeDocument();</script>
41 --- cacti-0.8.7e/lib/html_form.php 2009-06-28 12:07:11.000000000 -0400
42 +++ cacti-0.8.7e-patched/lib/html_form.php 2009-11-21 23:15:40.000000000 -0500
45 if (sizeof($items) > 0) {
46 foreach ($items as $item) {
47 - print $item["name"] . "<br>";
48 + print htmlspecialchars($item["name"],ENT_QUOTES) . "<br>";
54 + form_font_box($field_name, $field_array["value"],
55 + ((isset($field_array["default"])) ? $field_array["default"] : ""),
56 + $field_array["max_length"],
57 + ((isset($field_array["size"])) ? $field_array["size"] : "40"), "text",
58 + ((isset($field_array["form_id"])) ? $field_array["form_id"] : ""));
62 - print "<em>" . $field_array["value"] . "</em>";
63 + print "<em>" . htmlspecialchars($field_array["value"],ENT_QUOTES) . "</em>";
65 form_hidden_box($field_name, $field_array["value"], "");
68 $form_previous_value = $form_default_value;
71 - print "<input type='hidden' id='$form_name' name='$form_name' value='$form_previous_value'>\n";
72 + print "<input type='hidden' id='$form_name' name='$form_name' value='" . htmlspecialchars($form_previous_value, ENT_QUOTES) . "'>\n";
75 /* form_dropdown - draws a standard html dropdown box
80 - print ">". $array_display[$id];
81 + print ">". htmlspecialchars($array_display[$id],ENT_QUOTES);
89 +/* form_font_box - draws a standard html textbox and provides status of a fonts existence
90 + @arg $form_name - the name of this form element
91 + @arg $form_previous_value - the current value of this form element
92 + @arg $form_default_value - the value of this form element to use if there is
93 + no current value available
94 + @arg $form_max_length - the maximum number of characters that can be entered
96 + @arg $form_size - the size (width) of the textbox
97 + @arg $type - the type of textbox, either 'text' or 'password'
98 + @arg $current_id - used to determine if a current value for this form element
99 + exists or not. a $current_id of '0' indicates that no current value exists,
100 + a non-zero value indicates that a current value does exist */
101 +function form_font_box($form_name, $form_previous_value, $form_default_value, $form_max_length, $form_size = 30, $type = "text", $current_id = 0) {
102 + if (($form_previous_value == "") && (empty($current_id))) {
103 + $form_previous_value = $form_default_value;
106 + print "<input type='$type'";
108 + if (isset($_SESSION["sess_error_fields"])) {
109 + if (!empty($_SESSION["sess_error_fields"][$form_name])) {
110 + print "class='txtErrorTextBox'";
111 + unset($_SESSION["sess_error_fields"][$form_name]);
115 + if (isset($_SESSION["sess_field_values"])) {
116 + if (!empty($_SESSION["sess_field_values"][$form_name])) {
117 + $form_previous_value = $_SESSION["sess_field_values"][$form_name];
121 + if (strlen($form_previous_value) == 0) { # no data: defaults are used; everythings fine
124 + if (read_config_option("rrdtool_version") == "rrd-1.3.x") { # rrdtool 1.3 uses fontconfig
125 + $font = '"' . $form_previous_value . '"';
126 + $out_array = array();
127 + exec('fc-list ' . $font, $out_array);
128 + if (sizeof($out_array) == 0) {
129 + $extra_data = "<span style='color:red'><br>[" . "ERROR: FONT NOT FOUND" . "]</span>";
131 + $extra_data = "<span style='color:green'><br>[" . "OK: FONT FOUND" . "]</span>";
133 + } elseif (read_config_option("rrdtool_version") == "rrd-1.0.x" ||
134 + read_config_option("rrdtool_version") == "rrd-1.2.x") { # rrdtool 1.0 and 1.2 use font files
135 + if (is_file($form_previous_value)) {
136 + $extra_data = "<span style='color:green'><br>[" . "OK: FILE FOUND" . "]</span>";
137 + }else if (is_dir($form_previous_value)) {
138 + $extra_data = "<span style='color:red'><br>[" . "ERROR: IS DIR" . "]</span>";
140 + $extra_data = "<span style='color:red'><br>[" . "ERROR: FILE NOT FOUND" . "]</span>";
142 + } # will be used for future versions of rrdtool
145 + print " id='$form_name' name='$form_name' size='$form_size'" . (!empty($form_max_length) ? " maxlength='$form_max_length'" : "") . " value='" . htmlspecialchars($form_previous_value, ENT_QUOTES) . "'>" . $extra_data;
148 /* form_confirm - draws a table presenting the user with some choice and allowing
149 them to either proceed (delete) or cancel
150 @arg $body_text - the text to prompt the user with on this form
151 --- cacti-0.8.7e/lib/timespan_settings.php 2009-06-28 12:07:11.000000000 -0400
152 +++ cacti-0.8.7e-patched/lib/timespan_settings.php 2009-11-21 23:15:49.000000000 -0500
154 if (isset($_POST["date1"])) {
155 /* the dates have changed, therefore, I am now custom */
156 if (($_SESSION["sess_current_date1"] != $_POST["date1"]) || ($_SESSION["sess_current_date2"] != $_POST["date2"])) {
157 - $timespan["current_value_date1"] = $_POST["date1"];
158 + $timespan["current_value_date1"] = sanitize_search_string($_POST["date1"]);
159 $timespan["begin_now"] =strtotime($timespan["current_value_date1"]);
160 - $timespan["current_value_date2"] = $_POST["date2"];
161 + $timespan["current_value_date2"] = sanitize_search_string($_POST["date2"]);
162 $timespan["end_now"]=strtotime($timespan["current_value_date2"]);
163 $_SESSION["sess_current_timespan"] = GT_CUSTOM;
164 $_SESSION["custom"] = 1;
167 /* the default button wasn't pushed */
168 if (!isset($_POST["button_clear_x"])) {
169 - $timespan["current_value_date1"] = $_POST["date1"];
170 - $timespan["current_value_date2"] = $_POST["date2"];
171 + $timespan["current_value_date1"] = sanitize_search_string($_POST["date1"]);
172 + $timespan["current_value_date2"] = sanitize_search_string($_POST["date2"]);
173 $timespan["begin_now"] = $_SESSION["sess_current_timespan_begin_now"];
174 $timespan["end_now"] = $_SESSION["sess_current_timespan_end_now"];