aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-12 20:27:01 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-12 20:27:01 +0000
commit6673c56a3bb3cfd4d4fbbe946b4bee8b3b77db9b (patch)
treeeb8adb949e78e48a40c6f431ee52bd7c82b71b52 /channels
parent3c673d9a06c329c7b3fa121fda091e18006f3df7 (diff)
Merged revisions 108086 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r108086 | kpfleming | 2008-03-12 14:16:07 -0500 (Wed, 12 Mar 2008) | 6 lines if we receive an INVITE with a Content-Length that is not a valid number, or is zero, then don't process the rest of the message body looking for an SDP closes issue #11475 Reported by: andrebarbosa ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@108191 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index e5ac3b224..16bb34765 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -6150,6 +6150,7 @@ static void parse_request(struct sip_request *req)
static int find_sdp(struct sip_request *req)
{
const char *content_type;
+ const char *content_length;
const char *search;
char *boundary;
unsigned int x;
@@ -6157,6 +6158,20 @@ static int find_sdp(struct sip_request *req)
int found_application_sdp = FALSE;
int found_end_of_headers = FALSE;
+ content_length = get_header(req, "Content-Length");
+
+ if (!ast_strlen_zero(content_length)) {
+ if (sscanf(content_length, "%ud", &x) != 1) {
+ ast_log(LOG_WARNING, "Invalid Content-Length: %s\n", content_length);
+ return 0;
+ }
+
+ /* Content-Length of zero means there can't possibly be an
+ SDP here, even if the Content-Type says there is */
+ if (x == 0)
+ return 0;
+ }
+
content_type = get_header(req, "Content-Type");
/* if the body contains only SDP, this is easy */