#include <stdio.h>
char shellcode[]=
"\x31\xc0\x31\xdb\x31\xd2\x50\x68\x2e\x4f"
"\x52\x47\x68\x45\x4c\x4f\x4f\x68\x52\x4f"
"\x53\x49\x68\x57\x57\x57\x2e\x89\xe1\xb2"
"\x10\xb0\x04\xcd\x80\x31\xc0\x31\xdb\xb0"
"\x01\xcd\x80";
main()
{
(void) (*routine)();
(long) routine = &shellcode; //Problem line
printf("Size: %d bytes\n", sizeof(shellcode));
routine();
}
Why?
Btw, the shellcode just says "Hello World"
char shellcode[]=
"\x31\xc0\x31\xdb\x31\xd2\x50\x68\x2e\x4f"
"\x52\x47\x68\x45\x4c\x4f\x4f\x68\x52\x4f"
"\x53\x49\x68\x57\x57\x57\x2e\x89\xe1\xb2"
"\x10\xb0\x04\xcd\x80\x31\xc0\x31\xdb\xb0"
"\x01\xcd\x80";
main()
{
(void) (*routine)();
(long) routine = &shellcode; //Problem line
printf("Size: %d bytes\n", sizeof(shellcode));
routine();
}
Why?
Btw, the shellcode just says "Hello World"