[prev in list] [next in list] [prev in thread] [next in thread]
List: sr-dev
Subject: [sr-dev] git:master:feaafdb2: core: test if a module exports functions before converting to core str
From: Daniel-Constantin Mierla <miconda () gmail ! com>
Date: 2018-09-30 19:52:57
Message-ID: E1g6hlx-0004o0-H8 () www ! kamailio ! org
[Download RAW message or body]
Module: kamailio
Branch: master
Commit: feaafdb268001680fce461b62c3e81636667eb8e
URL: https://github.com/kamailio/kamailio/commit/feaafdb268001680fce461b62c3e81636667eb8e
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Committer: Daniel-Constantin Mierla <miconda@gmail.com>
Date: 2018-09-30T21:52:28+02:00
core: test if a module exports functions before converting to core struct
- reported by Juha Heinanen
---
Modified: src/core/sr_module.c
---
Diff: https://github.com/kamailio/kamailio/commit/feaafdb268001680fce461b62c3e81636667eb8e.diff
Patch: https://github.com/kamailio/kamailio/commit/feaafdb268001680fce461b62c3e81636667eb8e.patch
---
diff --git a/src/core/sr_module.c b/src/core/sr_module.c
index 6b607ea6ce..199a307068 100644
--- a/src/core/sr_module.c
+++ b/src/core/sr_module.c
@@ -208,7 +208,7 @@ static int register_module(module_exports_t* e, char* path, void* handle)
int ret, i;
struct sr_module* mod;
char defmod[64];
- int n;
+ int n = 0;
ret=-1;
@@ -227,7 +227,9 @@ static int register_module(module_exports_t* e, char* path, void* handle)
mod->exports.dlflags = e->dlflags;
- for (n=0; e->cmds[n].name; n++);
+ if(e->cmds) {
+ for (n=0; e->cmds[n].name; n++);
+ }
mod->exports.cmds = pkg_malloc(sizeof(ksr_cmd_export_t)*(n+1));
memset(mod->exports.cmds, 0, sizeof(ksr_cmd_export_t)*(n+1));
for (i=0; i < n; i++) {
_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic