Skip to content

Instantly share code, notes, and snippets.

@0xdeadbeefJERKY
Created September 24, 2017 18:04
Show Gist options
  • Save 0xdeadbeefJERKY/27f90124364842eb3b5ff8fc98549ec0 to your computer and use it in GitHub Desktop.
Save 0xdeadbeefJERKY/27f90124364842eb3b5ff8fc98549ec0 to your computer and use it in GitHub Desktop.
Simple C file explaining the execution of the 'ret' x86/x64 instruction
#include <stdio.h>
int main()
{
// call function and save the address
// pointing to the 'int varint = 0' line
// on the stack
printf("Hello world\n");
// once 'printf' is finished, pop
// the saved address off the stack
// to continue execution here
int varint = 0;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment