Module: kamailio
Branch: master
Commit: a3d9816d3881eb9743a14cb1306533469a821d47
URL:
https://github.com/kamailio/kamailio/commit/a3d9816d3881eb9743a14cb13065334…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-03-20T16:48:26+01:00
core: check for result of dlopen() pointers
---
Modified: src/core/sr_module.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a3d9816d3881eb9743a14cb13065334…
Patch:
https://github.com/kamailio/kamailio/commit/a3d9816d3881eb9743a14cb13065334…
---
diff --git a/src/core/sr_module.c b/src/core/sr_module.c
index f04d486908..62fc81f21b 100644
--- a/src/core/sr_module.c
+++ b/src/core/sr_module.c
@@ -594,7 +594,7 @@ int load_module(char* mod_path)
exit(-1);
}
mod_if_ver = (unsigned *)dlsym(handle, "module_interface_ver");
- if ( (error =(char*)dlerror())!=0 ){
+ if (mod_if_ver==NULL || (error =(char*)dlerror())!=0 ){
LM_ERR("no module interface version in module <%s>\n", path );
goto error1;
}
@@ -635,12 +635,10 @@ int load_module(char* mod_path)
snprintf(exbuf, 62, "_%.*s_exports", expref.len, expref.s);
LM_DBG("looking up exports with name: %s\n", exbuf);
exp = (union module_exports_u*)dlsym(handle, exbuf);
- if(exp==NULL) {
- if ( (error =(char*)dlerror())!=0 ){
- LM_ERR("failure for exports symbol: %s - dlerror: %s\n",
- exbuf, error);
- goto error1;
- }
+ if(exp==NULL || (error =(char*)dlerror())!=0 ){
+ LM_ERR("failure for exports symbol: %s - dlerror: %s\n",
+ exbuf, (error)?error:"none");
+ goto error1;
}
}
/* hack to allow for kamailio style dlflags inside exports */