mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-4162 Doesn't check for disallowed ognl expressions if getting from expression cache
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1533360 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -266,18 +266,22 @@ public class OgnlUtil {
|
||||
tree = expressions.get(expression);
|
||||
if (tree == null) {
|
||||
tree = Ognl.parseExpression(expression);
|
||||
checkEnableEvalExpression(tree, context);
|
||||
expressions.putIfAbsent(expression, tree);
|
||||
}
|
||||
} else {
|
||||
tree = Ognl.parseExpression(expression);
|
||||
}
|
||||
|
||||
if (!enableEvalExpression && isEvalExpression(tree, context)) {
|
||||
throw new OgnlException("Eval expressions has been disabled");
|
||||
checkEnableEvalExpression(tree, context);
|
||||
}
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
private void checkEnableEvalExpression(Object tree, Map<String, Object> context) throws OgnlException {
|
||||
if (!enableEvalExpression && isEvalExpression(tree, context)) {
|
||||
throw new OgnlException("Eval expressions has been disabled!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the properties in the object "from" and sets them in the object "to"
|
||||
|
||||
Reference in New Issue
Block a user