aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--conf/config.php3
-rw-r--r--graph.php5
2 files changed, 8 insertions, 0 deletions
diff --git a/conf/config.php b/conf/config.php
index 5ce761b..26172b1 100644
--- a/conf/config.php
+++ b/conf/config.php
@@ -63,6 +63,9 @@ $CONFIG['height'] = 175;
63# default width/height of detailed graphs 63# default width/height of detailed graphs
64$CONFIG['detail-width'] = 800; 64$CONFIG['detail-width'] = 800;
65$CONFIG['detail-height'] = 350; 65$CONFIG['detail-height'] = 350;
66# max width/height of a graph (to prevent from OOM)
67$CONFIG['max-width'] = $CONFIG['detail-width'] * 2;
68$CONFIG['max-height'] = $CONFIG['detail-height'] * 2;
66 69
67# collectd's unix socket (unixsock plugin) 70# collectd's unix socket (unixsock plugin)
68# enabled: 'unix:///var/run/collectd-unixsock' 71# enabled: 'unix:///var/run/collectd-unixsock'
diff --git a/graph.php b/graph.php
index 37e442a..d170a6c 100644
--- a/graph.php
+++ b/graph.php
@@ -17,6 +17,11 @@ if (!file_exists($CONFIG['webdir'].'/plugin/'.$plugin.'.php')) {
17 error_image(); 17 error_image();
18} 18}
19 19
20if ($width > $CONFIG['max-width'] || $height > $CONFIG['max-height']) {
21 error_log('Resquested image is too large. Please configure max-width and max-height.');
22 error_image();
23}
24
20# load plugin 25# load plugin
21include $CONFIG['webdir'].'/plugin/'.$plugin.'.php'; 26include $CONFIG['webdir'].'/plugin/'.$plugin.'.php';
22 27