Skip to content

Commit 3dbdfbd

Browse files
authored
Default --rop to 5 if not specified (#65)
1 parent a60f811 commit 3dbdfbd

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/rp/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ int main(int argc, char *argv[]) {
7171
fmt::print("You are currently using the version {} of rp++.\n", VERSION);
7272
}
7373

74+
// It has been confusing for users to run & see no rop gadget displayed..so
75+
// we'll default the gadget length setting for them.
76+
if (g_opts.display == 0 && g_opts.rop == 0) {
77+
fmt::print("No rop gadget length was specified via --rop, so setting "
78+
"it to 5..\n");
79+
g_opts.rop = 5;
80+
}
81+
7482
Program p(g_opts.file, g_opts.raw);
7583
if (g_opts.display >= VERBOSE_LEVEL_1 &&
7684
g_opts.display <= VERBOSE_LEVEL_3) {

src/rp/ropsearch_algorithm.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ void find_rop_gadgets(const std::vector<uint8_t> &section, const uint64_t vaddr,
117117
InstructionInformation ret_instr = disass_engine.disass(
118118
data + offset, size - offset, SafeIntAdd(vaddr, offset), ret);
119119

120-
// OK either this is an unknow opcode & we goto the next one Or the
121-
// instruction encountered is too long & we also goto the next one in that
122-
// case
120+
// OK either this is an unknow opcode or the instruction is too long; in
121+
// either case we goto the next one.
123122
if (ret == UnknownInstruction || ret == OutOfBlock) {
124123
continue;
125124
}

0 commit comments

Comments
 (0)