From 4d65ccd0529869be59d12a6aa9a2b433f7ca59d0 Mon Sep 17 00:00:00 2001 From: d-millar <33498836+d-millar@users.noreply.github.com> Date: Tue, 20 Apr 2021 17:54:39 +0000 Subject: [PATCH] GP-866: resetSyntax required to prevent parsing of numbers as numbers in command line --- .../ghidra/dbg/target/TargetLauncher.java | 1 + .../ghidra/dbg/target/TargetLauncherTest.java | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetLauncherTest.java 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")); + } +}