Module: sip-router
Branch: jh/mtree
Commit: 36c2ea8fe8a9e2967d7ca66c5bd7d385f671298d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=36c2ea8…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Thu Sep 1 11:36:33 2011 +0300
modules/utils: check in_list() separator already in fixup function
---
modules/utils/functions.c | 11 +----------
modules/utils/utils.c | 12 +++++++++---
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/modules/utils/functions.c b/modules/utils/functions.c
index bdd4491..a95e8f6 100644
--- a/modules/utils/functions.c
+++ b/modules/utils/functions.c
@@ -185,16 +185,7 @@ int in_list(struct sip_msg* _m, char* _subject, char* _list, char*
_sep)
if (list.len == 0) return -1;
}
- if (strlen(_sep) != 1) {
- LM_ERR("separator needs to be a one charter string\n");
- return -1;
- } else {
- sep = _sep[0];
- if (sep == 0) {
- LM_INFO("separator cannot be NUL\n");
- return -1;
- }
- }
+ sep = _sep[0];
at = list.s;
past = list.s + list.len;
diff --git a/modules/utils/utils.c b/modules/utils/utils.c
index 88ea37f..7b5f38b 100644
--- a/modules/utils/utils.c
+++ b/modules/utils/utils.c
@@ -372,8 +372,14 @@ static int fixup_free_http_query(void** param, int param_no)
static int fixup_in_list(void** param, int param_no)
{
if ((param_no == 1) || (param_no == 2)) return fixup_spve_null(param, 1);
-
- if (param_no == 3) return 0;
+
+ if (param_no == 3) {
+ if ((strlen((char *)*param) != 1) || (*((char *)(*param)) == 0)) {
+ LM_ERR("invalid separator parameter\n");
+ return -1;
+ }
+ return 0;
+ }
LM_ERR("invalid parameter number <%d>\n", param_no);
return -1;
@@ -388,7 +394,7 @@ static int fixup_free_in_list(void** param, int param_no)
LM_WARN("free function has not been defined for spve\n");
return 0;
}
-
+
if (param_no == 3) return 0;
LM_ERR("invalid parameter number <%d>\n", param_no);