[sr-dev] git:4.0: rtpproxy: proper fixup function for rtpproxy_manage(...)

Daniel-Constantin Mierla miconda at gmail.com
Fri Mar 1 18:19:57 CET 2013


Module: sip-router
Branch: 4.0
Commit: 0d6e0778ef4d86ebd06671333f86f45fc2ec375d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0d6e0778ef4d86ebd06671333f86f45fc2ec375d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Mar  1 18:12:23 2013 +0100

rtpproxy: proper fixup function for rtpproxy_manage(...)

- second parameter was resolved as spve type, although fixed as str
- reported by  Markus Bucher, FS#273
(cherry picked from commit b23510e0adb6060a257c8662700450ed7faef080)

---

 modules/rtpproxy/rtpproxy.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/modules/rtpproxy/rtpproxy.c b/modules/rtpproxy/rtpproxy.c
index 016a9a1..783eff9 100644
--- a/modules/rtpproxy/rtpproxy.c
+++ b/modules/rtpproxy/rtpproxy.c
@@ -411,7 +411,7 @@ static cmd_export_t cmds[] = {
 		fixup_spve_null, fixup_free_spve_null,
 		ANY_ROUTE},
 	{"rtpproxy_manage",	(cmd_function)rtpproxy_manage2,     2,
-		fixup_spve_str, fixup_free_spve_str,
+		fixup_spve_spve, fixup_free_spve_spve,
 		ANY_ROUTE},
 	{0, 0, 0, 0, 0, 0}
 };
@@ -2037,7 +2037,11 @@ static int
 rtpproxy_manage1(struct sip_msg *msg, char *flags, char *ip)
 {
 	str flag_str;
-	fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
+	if(fixup_get_svalue(msg, (gparam_p)flags, &flag_str)<0)
+	{
+		LM_ERR("invalid flags parameter\n");
+		return -1;
+	}
 	return rtpproxy_manage(msg, flag_str.s, 0);
 }
 
@@ -2046,8 +2050,16 @@ rtpproxy_manage2(struct sip_msg *msg, char *flags, char *ip)
 {
 	str flag_str;
 	str ip_str;
-	fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
-	fixup_get_svalue(msg, (gparam_p)ip, &ip_str);
+	if(fixup_get_svalue(msg, (gparam_p)flags, &flag_str)<0)
+	{
+		LM_ERR("invalid flags parameter\n");
+		return -1;
+	}
+	if(fixup_get_svalue(msg, (gparam_p)ip, &ip_str)<0)
+	{
+		LM_ERR("invalid IP parameter\n");
+		return -1;
+	}
 	return rtpproxy_manage(msg, flag_str.s, ip_str.s);
 }
 




More information about the sr-dev mailing list