Module: sip-router
Branch: 4.0
Commit: 533f2238d9d14ed8ef0a367ce574aef8052c0452
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=533f223…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun May 26 16:14:51 2013 +0200
topoh: safety check for SIP messages
- received callback can be executed for non-sip messages
- reported by Julia
(cherry picked from commit 352a7dccf2570af857d7e2e50fed600c4762278d)
---
modules/topoh/topoh_mod.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/modules/topoh/topoh_mod.c b/modules/topoh/topoh_mod.c
index f42b928..73ebf21 100644
--- a/modules/topoh/topoh_mod.c
+++ b/modules/topoh/topoh_mod.c
@@ -204,6 +204,18 @@ int th_prepare_msg(sip_msg_t *msg)
return 1;
}
+ if(msg->first_line.type==SIP_REQUEST)
+ {
+ if(!IS_SIP(msg))
+ {
+ LM_DBG("non sip request message\n");
+ return 1;
+ }
+ } else if(msg->first_line.type!=SIP_REPLY) {
+ LM_DBG("non sip message\n");
+ return 1;
+ }
+
if (parse_headers(msg, HDR_EOH_F, 0)==-1)
{
LM_DBG("parsing headers failed");