By using buffer overflow how to execute overflowed() function by using gdb in linux?

46 Views Asked by At
#include <string.h>
#include <stdio.h>

void overflowed() {
    printf("%s\n", "Execution Hijacked");
}

void function1(char *str) {
    char buffer[5];
    strcpy(buffer, str);
}

void main(int argc, char *argv[]) {
    function1(argv[1]);
    printf("%s\n", "Executed normally");
}

Hello .. I am trying to execute overflowed() function using eip controlling can anyone show me how to execute it and how to compute offset between two address?

I computed the offset between main and overflowed() and before making breakpoint in the main then I made breakpoint in the main then run with the offset + the address of overflowed() , it is not work.

0

There are 0 best solutions below