From b77c6723568445678647eca272eafd2a32b92869 Mon Sep 17 00:00:00 2001 From: rainphp Date: Wed, 14 May 2014 11:02:23 -0400 Subject: [PATCH] Check for file size --- library/Rain/Tpl/Parser.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/Rain/Tpl/Parser.php b/library/Rain/Tpl/Parser.php index df33049..88a201c 100644 --- a/library/Rain/Tpl/Parser.php +++ b/library/Rain/Tpl/Parser.php @@ -80,6 +80,8 @@ class Parser { 'syslog', 'xmlrpc_entity_decode' ); + private $SECURITY_CHECK = ""; + public function __construct($config, $plugins, $registered_tags) { $this->config = $config; static::$plugins = $plugins; @@ -123,7 +125,11 @@ public function compileFile( $this->templateInfo['template_filepath'] = $templateFilepath; // read the file - $this->templateInfo['code'] = $code = fread($fp, filesize($templateFilepath)); + $filesize = filesize($templateFilepath); + if (!$filesize) { + $parsedCode = self::$SECURITY_CHECK; + } else { + $this->templateInfo['code'] = $code = fread($fp, $filesize) : ""; // xml substitution $code = preg_replace("/<\?xml(.*?)\?>/s", /*