[Asterisk-code-review] loader.c: Fix possible SEGV when a module fails to register (...asterisk[16])

George Joseph asteriskteam at digium.com
Mon Jul 29 08:38:39 CDT 2019


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11637


Change subject: loader.c:  Fix possible SEGV when a module fails to register
......................................................................

loader.c:  Fix possible SEGV when a module fails to register

When a module fails to register itself (usually a coding error
in the module), dlerror() can return NULL.  We weren't checking
for that in load_dlopen() before trying to strdup the error message
so a SEGV was thrown.  dlerror() is now surrounded with an S_OR
so we don't SEGV.

Change-Id: Ie0fb9316f08a321434f3f85aecf3c7d2ede8b956
---
M main/loader.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/37/11637/1

diff --git a/main/loader.c b/main/loader.c
index b46f745..033693e 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -1087,7 +1087,7 @@
 	if (resource_being_loaded) {
 		struct ast_str *list;
 		int c = 0;
-		const char *dlerror_msg = ast_strdupa(dlerror());
+		const char *dlerror_msg = ast_strdupa(S_OR(dlerror(), ""));
 
 		resource_being_loaded = NULL;
 		if (mod->lib) {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11637
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ie0fb9316f08a321434f3f85aecf3c7d2ede8b956
Gerrit-Change-Number: 11637
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190729/c6fc6f52/attachment-0001.html>


More information about the asterisk-code-review mailing list