Module: kamailio
Branch: master
Commit: 46daf3011d077e359274ff3322440d50625ce5e5
URL:
https://github.com/kamailio/kamailio/commit/46daf3011d077e359274ff3322440d5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-11-02T15:21:28+01:00
app_python: dname is always allocated in system memory
- pointing it to static string will crash the free at shutdown
---
Modified: modules/app_python/app_python_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/46daf3011d077e359274ff3322440d5…
Patch:
https://github.com/kamailio/kamailio/commit/46daf3011d077e359274ff3322440d5…
---
diff --git a/modules/app_python/app_python_mod.c b/modules/app_python/app_python_mod.c
index 02ff097..9fd6264 100644
--- a/modules/app_python/app_python_mod.c
+++ b/modules/app_python/app_python_mod.c
@@ -122,8 +122,20 @@ static int mod_init(void)
}
dname = strdup(dirname(dname_src));
- if (strlen(dname) == 0)
- dname = ".";
+ if(dname==NULL) {
+ LM_ERR("no more system memory\n");
+ return -1;
+ }
+ if (strlen(dname) == 0) {
+ free(dname);
+ dname = malloc(2);
+ if(dname==NULL) {
+ LM_ERR("no more system memory\n");
+ return -1;
+ }
+ dname[0] = '.';
+ dname[1] = '\0';
+ }
bname = strdup(basename(bname_src));
i = strlen(bname);
if (bname[i - 1] == 'c' || bname[i - 1] == 'o')