We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int main() { #if defined(APPLE) void *handle = dlopen("libc.dylib", RTLD_NOW); #else void *handle = dlopen("libc.so", RTLD_NOW); #endif assert(handle != nullptr); void *symbol = dlsym(handle, "getenv"); assert(symbol != nullptr); printf("Orig getenv = %p\n", symbol); WInlineHookFunction( symbol, reinterpret_cast<void *>(Hooked_getenv), reinterpret_cast<void **>(&Origin_getenv) ); // WImportHookFunction( // "_getenv", // reinterpret_cast<void *>(Hooked_getenv), // reinterpret_cast<void **>(&Origin_getenv) // ); const char *val = getenv("lody1"); //这里如果是输入“lody“可以hook成功打印出了"are you ok?",但是如果是“lody1”就会出现Segmentation fault 139错误 std::cout << val; return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
int main() {
#if defined(APPLE)
void *handle = dlopen("libc.dylib", RTLD_NOW);
#else
void *handle = dlopen("libc.so", RTLD_NOW);
#endif
assert(handle != nullptr);
void *symbol = dlsym(handle, "getenv");
assert(symbol != nullptr);
printf("Orig getenv = %p\n", symbol);
WInlineHookFunction(
symbol,
reinterpret_cast<void *>(Hooked_getenv),
reinterpret_cast<void **>(&Origin_getenv)
);
// WImportHookFunction(
// "_getenv",
// reinterpret_cast<void *>(Hooked_getenv),
// reinterpret_cast<void **>(&Origin_getenv)
// );
const char *val = getenv("lody1"); //这里如果是输入“lody“可以hook成功打印出了"are you ok?",但是如果是“lody1”就会出现Segmentation fault 139错误
std::cout << val;
return 0;
}
The text was updated successfully, but these errors were encountered: