Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-5526 Simplified fix for CreateThunkFunctionCmd

ghidra19a20684330e1
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.java
index 52278eb741..5d5c5f7d76 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.java
@@ -567,8 +567,8 @@ public class CreateThunkFunctionCmd extends BackgroundCommand<Program> {
// if there is no pcode, go to the next instruction
// assume fallthrough (ie. x86 instruction ENDBR64)
// TODO: at some point, might need to do a NOP detection
- while (instr != null && instr.getPcode().length == 0) {
- instr = listing.getInstructionAfter(instr.getAddress());
+ if (instr != null && instr.getPcode().length == 0) {
+ instr = listing.getInstructionAfter(entry);
}
if (instr == null) {
return null;