Part 46 – Hacking Pre-Decrement Operator
For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Reverse-Engineering-Tutorial
Let's re-examine our code.
#include <iostream> int main(void) { int myNumber = 16; int myNewNumber = --myNumber; std::cout << myNewNumber << std::endl; std::cout << myNumber << std::endl; return 0; }
We remember when we compile we get 15.
Let's debug.
Let's break.
Let's review what is inside r3 and hack it.
Now as we continue we see it did not successfully hack why is that?
We re-run the binary and break and see the value here at r1 hold 15.
When we continue we see 15 which we don't want.
Now we break again and print the value.
This time we set r1 and we can see we have successfully hacked!
This is your first experience with really breaking down the registers and seeing where things are stored and how it can affect outcome. Take time and run this yourself so you really have a firm handle on this.
Next week we will dive into the Post-Decrement Operator.