Module: sip-router
Branch: master
Commit: 7fc74e46a5d5b4e2b0cbbe5bdc1627e672867164
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7fc74e4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Dec 14 00:43:04 2012 +0100
dialog(k): reset default value for optional parameter
- some rpc transports set a static string for missing optional
parameters, causing invalid value
- dlg.bridge_dlg proper handling of optional parameters return code
---
modules_k/dialog/dialog.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules_k/dialog/dialog.c b/modules_k/dialog/dialog.c
index cf77398..13fa807 100644
--- a/modules_k/dialog/dialog.c
+++ b/modules_k/dialog/dialog.c
@@ -1626,7 +1626,11 @@ static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
rpc->fault(c, 500, "Invalid parameters");
return;
}
- rpc->scan(c, "*S", &rpc_extra_hdrs);
+ if(rpc->scan(c, "*S", &rpc_extra_hdrs)<1)
+ {
+ rpc_extra_hdrs.s = NULL;
+ rpc_extra_hdrs.len = 0;
+ }
dlg = dlg_lookup(h_entry, h_id);
if(dlg==NULL) {
@@ -1665,8 +1669,18 @@ static void rpc_dlg_bridge(rpc_t *rpc, void *c) {
str from = {NULL,0};
str to = {NULL,0};
str op = {NULL,0};
+ int n;
- if (rpc->scan(c, "SS*S", &from, &to, &op) < 2) return;
+ n = rpc->scan(c, "SS", &from, &to);
+ if (n< 2) {
+ LM_ERR("unable to read the parameters (%d)\n", n);
+ rpc->fault(c, 500, "Invalid parameters");
+ return;
+ }
+ if(rpc->scan(c, "*S", &op)<1) {
+ op.s = NULL;
+ op.len = 0;
+ }
dlg_bridge(&from, &to, &op);
}