我在我的一个项目中破解了 glibc 的 printf() 并遇到了一些问题。您能提供一些线索吗?我关心的问题之一是为什么同样的 malloc/free 解决方案可以完美地工作!
\n\n如附件所示,\xe2\x80\x9cPrintfHank.c\xe2\x80\x9d 包含我自己的 printf() 解决方案,它将在标准库之前预加载;而 \xe2\x80\x9cmain.c\xe2\x80\x9d 只是使用 printf() 输出一个句子。编辑两个文件后,我发出以下命令:
\n\n但我在控制台中的 printf\xe2\x80\x9d 中收到了 \xe2\x80\x9chello world\xe2\x80\x9d 而不是 \xe2\x80\x9c 。当破解 malloc/free 函数时,\xe2\x80\x99s 没问题。
\n\n我以 \xe2\x80\x9croot\xe2\x80\x9d 身份登录系统,并使用 2.6.23.1-42.fc8-i686。任何意见将不胜感激!
\n\n主程序
\n\n#include <stdio.h>\n\nint main(void)\n{\n printf("hello world\\n");\n\n return 0;\n}\nRun Code Online (Sandbox Code Playgroud)\n\nPrintfHank.c
\n\n#ifndef _GNU_SOURCE\n#define _GNU_SOURCE\n#endif\n\n#include <stdio.h>\n#include <dlfcn.h>\n\nstatic int (*orig_printf)(const char *format, ...) …Run Code Online (Sandbox Code Playgroud)