Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-866: resetSyntax required to prevent parsing of numbers as numbers in command line

d-millar4d65ccd05298
diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetLauncher.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetLauncher.java
index a832c3745f..a6219e422f 100644
--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetLauncher.java
+++ b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetLauncher.java
@@ -98,6 +98,7 @@ public interface TargetLauncher extends TargetObject {
public CmdLineParser(Reader r) {
super(r);
+ resetSyntax();
wordChars(0, 255);
whitespaceChars(' ', ' ');
quoteChar('"');
diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetLauncherTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetLauncherTest.java
new file mode 100644
index 0000000000..0638fbfb0a
--- /dev/null
+++ b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetLauncherTest.java
@@ -0,0 +1,32 @@
+/* ###
+ * IP: GHIDRA
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ghidra.dbg.target;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import ghidra.dbg.target.TargetLauncher.CmdLineParser;
+
+public class TargetLauncherTest {
+ @Test
+ public void testCmdLineParser() {
+ assertEquals(List.of("C:\\Windows", "10\\notepad.exe"),
+ CmdLineParser.tokenize("C:\\Windows 10\\notepad.exe"));
+ }
+}