- 论坛徽章:
- 1
|
本帖最后由 firkraag 于 2012-06-13 13:51 编辑
回复 6# sygspjlsj
I thought there was something wrong in the code of the book. The reason is as linuxfellow have said,"It is not the memory layout of ./memorylayout, but the /bin/cat's memory layout."
You can modify the code like this:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main( ){
char cmd[32];
brk((void *)0x8051000);
int pid=getpid();
sprintf(cmd, "cat /proc/%d/maps",pid);
system(cmd);
return 0;
}
But before you run this program, you should shutdown the aslr first: "echo 0 > /proc/sys/kernel/randomize_va_space" as root user.
For what is the aslr, you can search it on the internet. |
评分
-
查看全部评分
|