Browse Source

core: parse sdp - check for body limit on mixed content

(cherry picked from commit d4bbde619bbf808edebb31e131b3783ba2a4b34d)
Daniel-Constantin Mierla 11 months ago
parent
commit
eb058dba96
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/core/parser/sdp/sdp.c

+ 4 - 2
src/core/parser/sdp/sdp.c

@@ -810,9 +810,11 @@ static int parse_mixed_content(str *mixed_body, str delimiter, sdp_info_t *_sdp)
 		} /* end of while */
 		/* and now we need to parse the content */
 		if(start_parsing) {
-			while(('\n' == *rest) || ('\r' == *rest) || ('\t' == *rest)
-					|| (' ' == *rest))
+			while((rest < bodylimit)
+					&& (('\n' == *rest) || ('\r' == *rest) || ('\t' == *rest)
+							|| (' ' == *rest))) {
 				rest++; /* Skip any whitespace */
+			}
 			_sdp->raw_sdp.s = rest;
 			_sdp->raw_sdp.len = d2p - rest;
 			/* LM_DBG("we need to check session %d: <%.*s>\n", session_num, _sdp.raw_sdp.len, _sdp.raw_sdp.s); */