From 3297026a00afaa4386838eee3432648d1d2d9011 Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 30 Mar 2005 16:45:24 +0000 Subject: [PATCH] disallow variable func calls when security is enabled --- libs/Smarty_Compiler.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index aaca80ff..51c15ea2 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1372,6 +1372,9 @@ class Smarty_Compiler extends Smarty { !in_array($token, $this->security_settings['IF_FUNCS'])) { $this->_syntax_error("(secure mode) '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__); } + } elseif($this->security && preg_match('~^' . $this->_var_regexp . '$~', $token) && isset($tokens[$i+1]) && $tokens[$i+1] == '(') { + // variable function call + $this->_syntax_error("(secure mode) variable function call '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__); } elseif(preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)$~', $token)) { // object or variable $token = $this->_parse_var_props($token);