bug fixed for wall-filter. for issue #2167

This commit is contained in:
wenshao
2018-02-04 15:03:20 +08:00
parent ac5edc6b36
commit 98fd85140c
2 changed files with 20 additions and 1 deletions
@@ -1975,7 +1975,7 @@ public class SQLExprParser extends SQLParser {
for (;;) {
lexer.nextToken();
SQLExpr more = relational();
SQLExpr more = and();
group.add(more);
if (lexer.token == Token.OR) {
if (lexer.isKeepComments() && lexer.hasComment()) {
@@ -0,0 +1,19 @@
package com.alibaba.druid.bvt.filter.wall.mysql;
import com.alibaba.druid.wall.WallProvider;
import com.alibaba.druid.wall.spi.MySqlWallProvider;
import junit.framework.TestCase;
import org.junit.Assert;
public class MySqlWallTest148 extends TestCase {
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
String sql = "select * from TABLENAME cfgdatasou0_ where cfgdatasou0_.type=? and cfgdatasou0_.module_name=? and cfgdatasou0_.node_type=? or cfgdatasou0_.type=? and cfgdatasou0_.module_name=? and cfgdatasou0_.node_type=? or cfgdatasou0_.type=? and cfgdatasou0_.module_name=? and cfgdatasou0_.node_type=?";
Assert.assertTrue(
provider.checkValid(sql)
);
}
}