Module: kamailio
Branch: master
Commit: b05f3637f9cc829470d04037f6f5b88e37819706
URL:
https://github.com/kamailio/kamailio/commit/b05f3637f9cc829470d04037f6f5b88…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-08-03T05:02:41+02:00
cplc: safety checks for parameters
---
Modified: src/modules/cplc/cpl_nonsig.c
Modified: src/modules/cplc/cpl_switches.h
---
Diff:
https://github.com/kamailio/kamailio/commit/b05f3637f9cc829470d04037f6f5b88…
Patch:
https://github.com/kamailio/kamailio/commit/b05f3637f9cc829470d04037f6f5b88…
---
diff --git a/src/modules/cplc/cpl_nonsig.c b/src/modules/cplc/cpl_nonsig.c
index d87c02d18f..ba53ee0ab6 100644
--- a/src/modules/cplc/cpl_nonsig.c
+++ b/src/modules/cplc/cpl_nonsig.c
@@ -230,11 +230,18 @@ void cpl_aux_process( int cmd_out, char *log_dir)
LM_ERR("cannot set to IGNORE SIGCHLD signal\n");
}
+ file[0] = '\0';
+ file_ptr = file;
/* set the path for logging */
if (log_dir) {
- strcpy( file, log_dir);
- file_ptr = file + strlen(log_dir);
- *(file_ptr++) = '/';
+ if(strlen(log_dir)>=MAX_LOG_DIR_SIZE) {
+ /* fallback */
+ LM_ERR("log dir path is too long, ignoring - check workdir\n");
+ } else {
+ strcpy(file, log_dir);
+ file_ptr = file + strlen(log_dir);
+ *(file_ptr++) = '/';
+ }
}
while(1) {
diff --git a/src/modules/cplc/cpl_switches.h b/src/modules/cplc/cpl_switches.h
index 4a99b2cbe4..2accfd21b9 100644
--- a/src/modules/cplc/cpl_switches.h
+++ b/src/modules/cplc/cpl_switches.h
@@ -873,6 +873,12 @@ inline static int is_lang_tag_matching(str *range,str *cpl_tag,str
*cpl_subtag)
str tag = {0,0};
str subtag = {0,0};
+ if(range==NULL || cpl_tag==NULL || cpl_subtag==NULL) {
+ return -1;
+ }
+ if(range->s==NULL || cpl_tag->s==NULL || cpl_subtag->s==NULL) {
+ return -1;
+ }
c = range->s;
end = range->s + range->len;