考虑我有一个动态的外部库libExternal.dylib以下功能的外部库函数: void print(char* str)
{
// Changes the first char to 'a' and prints the string
*str = 'a';
printf("%s\n", str);
}
接下来,我有一个加载这个外部库和调用可执行(检查省略
Overriding 'malloc' using the LD_PRELOAD mechanism 如何LD_PRELOAD用于设置ptr为NULL或任何其他的存储器地址,以避免悬挂指针漏洞。 void free(void *ptr)
{
real_free(ptr);
ptr = NULL // will only set local ptr to NULL
}
我有一个奇怪的问题。当我使用共享库的参数调用导入的方法时,在这些方法中我有错误的参数。它是这样的: x = 1; y = 2; z = 3;
(*method)(x,y,z);
在方法,我有: void method(int x, int y, int z){
// x = 2, y = 3, z = 32432423 - something like this
}
这里我怎