I'm following Aleph One's awesome introduction to smashing the stack, but I've gotten stuck running one of the example programs he has. The issue is that when I compile the line jmp 0x2a
, and disassemble it, that exact line is produced, whereas in aleph's code, it is translated to jmp 0x800015f <main+47>
. How do I force gcc to make this a relative jump and not an absolute one (which is what I think is going on).
The problem is the 0x2a
. That looks like an absolute address, but what you want is a relative address.
That can be accomplished by labeling the destination and jumping to that: assemblers prefer generating a relative jump most of the time. Or use a relative address. Most assemblers accept something similar to .+0x2a
where .
is a symbol meaning the current instruction pointer. Some use $
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With