I am trying to find connect symbol in libcrypto.so file using dlsym() and want to replace this connect with my method.
void * lib_orig_tols = dlopen(libcrypto.so, RTLD_GLOBAL);
void * p_orig_connectOriginal;
p_orig_connectOriginal = (void*)dlsym(lib_orig_tols, "connect");
if (p_orig_connectOriginal != NULL)
{
LOGI(" is not NULL");
void *p_orig_connect = (void*)*((unsigned *)p_orig_connectOriginal);
*((unsigned *)p_orig_connectOriginal) = (unsigned)( my_crypto_connect);
}
int my_crypto_connect(int , const struct sockaddr , socklen_t){
**
***********
***************
**********
}
My my app got crashed with error
is not NULL
Fatal signal 11 (SIGSEGV), code 2, fault addr 0xb6e4755d in tid 7909
do i am doing something wrong.
unsigned*is not a valid function pointer.p_orig_connectOriginalinto function pointer.connectthen i will get that call.