From 651f9d9d87beb541ee9e1b6d9429d4695a2b0db2 Mon Sep 17 00:00:00 2001 From: f0o Date: Mon, 11 May 2015 12:14:56 +0000 Subject: [PATCH] Added sanity check --- includes/rrdtool.inc.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 5e5a9c0dd..7938eaf80 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -257,16 +257,15 @@ function rrdtool_lastupdate($filename, $options) function rrdtool_escape($string, $maxlength = NULL) { $result = shorten_interface_type($string); - if ( is_numeric($maxlength) ) { $extra = substr_count($string,':',0,$maxlength); $result = substr(str_pad($result, $maxlength),0,$maxlength+$extra); - $result = substr($result,0,(-1*$extra)); + if( $extra > 0 ) { + $result = substr($result,0,(-1*$extra)); + } } - $result = str_replace(':','\:',$result); - - return $result." "; + return $result." "; } ?>