diff options
| author | Peter Wu | 2014-07-20 17:03:32 +0200 |
|---|---|---|
| committer | Peter Wu | 2014-07-20 23:30:55 +0200 |
| commit | e6133be6095b8900b86bd982d435d8b901a47a28 (patch) | |
| tree | 6d35ac9803faef18569c8cf8a5206e41b1dddcae /inc | |
| parent | Use a more secure command line building method (diff) | |
| download | apt-panopticon_cgp-e6133be6095b8900b86bd982d435d8b901a47a28.zip apt-panopticon_cgp-e6133be6095b8900b86bd982d435d8b901a47a28.tar.gz apt-panopticon_cgp-e6133be6095b8900b86bd982d435d8b901a47a28.tar.bz2 apt-panopticon_cgp-e6133be6095b8900b86bd982d435d8b901a47a28.tar.xz | |
Escape file argument for rrd_info
Also init info_array in case the output is empty.
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/rrdtool.class.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/inc/rrdtool.class.php b/inc/rrdtool.class.php index f7907ec..6b7d949 100644 --- a/inc/rrdtool.class.php +++ b/inc/rrdtool.class.php | |||
| @@ -14,8 +14,13 @@ class RRDTool { | |||
| 14 | 14 | ||
| 15 | function rrd_info($rrdfile) { | 15 | function rrd_info($rrdfile) { |
| 16 | if (file_exists($rrdfile)) { | 16 | if (file_exists($rrdfile)) { |
| 17 | $raw_info = shell_exec($this->rrdtool.' info '.$rrdfile); | 17 | $raw_info = shell_exec( |
| 18 | escapeshellarg($this->rrdtool) | ||
| 19 | . " info " . | ||
| 20 | escapeshellarg($rrdfile) | ||
| 21 | ); | ||
| 18 | $raw_array = explode("\n", $raw_info); | 22 | $raw_array = explode("\n", $raw_info); |
| 23 | $info_array = array(); | ||
| 19 | foreach ($raw_array as $key => $info) { | 24 | foreach ($raw_array as $key => $info) { |
| 20 | if ($info != "") { | 25 | if ($info != "") { |
| 21 | $item_info = explode(" = ", $info); | 26 | $item_info = explode(" = ", $info); |
| @@ -23,7 +28,7 @@ class RRDTool { | |||
| 23 | $info_array[$item_info[0]] = $item_info[1]; | 28 | $info_array[$item_info[0]] = $item_info[1]; |
| 24 | } | 29 | } |
| 25 | } | 30 | } |
| 26 | return($info_array); | 31 | return $info_array; |
| 27 | } else { | 32 | } else { |
| 28 | return false; | 33 | return false; |
| 29 | } | 34 | } |
