GP-6736 escape bsim filter data

This commit is contained in:
James
2026-05-05 09:39:18 -04:00
parent 9c066df19d
commit bc3928da5a
3 changed files with 15 additions and 3 deletions
@@ -17,6 +17,8 @@ package ghidra.features.bsim.gui.filters;
import java.sql.SQLException;
import org.postgresql.core.Utils;
import ghidra.features.bsim.query.client.IDSQLResolution;
import ghidra.features.bsim.query.client.SQLEffects;
import ghidra.features.bsim.query.description.ExecutableRecord;
@@ -39,7 +41,9 @@ public class ExecutableNameBSimFilterType extends BSimFilterType {
throws SQLException {
effect.setExeTable();
StringBuilder buf = new StringBuilder();
buf.append("exetable.name_exec = '").append(atom.value).append('\'');
buf.append("exetable.name_exec = '");
Utils.escapeLiteral(buf, atom.value, true);
buf.append('\'');
effect.addWhere(this, buf.toString());
}
@@ -17,6 +17,8 @@ package ghidra.features.bsim.gui.filters;
import java.sql.SQLException;
import org.postgresql.core.Utils;
import ghidra.features.bsim.query.client.IDSQLResolution;
import ghidra.features.bsim.query.client.SQLEffects;
import ghidra.features.bsim.query.description.ExecutableRecord;
@@ -38,7 +40,9 @@ public class NotExecutableNameBSimFilterType extends BSimFilterType {
throws SQLException {
effect.setExeTable();
StringBuilder buf = new StringBuilder();
buf.append("exetable.name_exec != '").append(atom.value).append('\'');
buf.append("exetable.name_exec != '");
Utils.escapeLiteral(buf, atom.value, true);
buf.append('\'');
effect.addWhere(this, buf.toString());
}
@@ -17,6 +17,8 @@ package ghidra.features.bsim.gui.filters;
import java.sql.SQLException;
import org.postgresql.core.Utils;
import ghidra.features.bsim.query.client.IDSQLResolution;
import ghidra.features.bsim.query.client.SQLEffects;
import ghidra.features.bsim.query.description.ExecutableRecord;
@@ -40,7 +42,9 @@ public class PathStartsBSimFilterType extends BSimFilterType {
effect.setExeTable();
effect.setPathTable();
StringBuilder buf = new StringBuilder();
buf.append("position( \'").append(atom.value).append("\' in pathtable.val) = 1");
buf.append("position( '");
Utils.escapeLiteral(buf, atom.value, true);
buf.append("' in pathtable.val) = 1");
effect.addWhere(this, buf.toString());
}
}