|
@@ -733,9 +733,10 @@ int extract_sess_version(str *oline, str *sess_version)
|
|
|
|
|
|
/*
|
|
|
* Auxiliary for some functions.
|
|
|
+ * - smode: if 1, pstart is pointing inside msg body
|
|
|
* Returns pointer to first character of found line, or NULL if no such line.
|
|
|
*/
|
|
|
-char *find_sdp_line(char *pstart, char *plimit, char linechar)
|
|
|
+char *find_sdp_line_start(char *pstart, char *plimit, char linechar, int smode)
|
|
|
{
|
|
|
static char linehead[3] = "x=";
|
|
|
char *cp, *cp1;
|
|
@@ -749,11 +750,14 @@ char *find_sdp_line(char *pstart, char *plimit, char linechar)
|
|
|
if(cp1 == NULL)
|
|
|
return NULL;
|
|
|
/*
|
|
|
- * As it is body, we assume it has previous line and we can
|
|
|
- * lookup previous character.
|
|
|
+ * smode==1 means it is msg body, thus it has previous line and it can
|
|
|
+ * lookup previous character even when cp1==pstart.
|
|
|
*/
|
|
|
- if(cp1[-1] == '\n' || cp1[-1] == '\r')
|
|
|
- return cp1;
|
|
|
+ if(cp1 > pstart || smode == 1) {
|
|
|
+ if(cp1[-1] == '\n' || cp1[-1] == '\r') {
|
|
|
+ return cp1;
|
|
|
+ }
|
|
|
+ }
|
|
|
/*
|
|
|
* Having such data, but not at line beginning.
|
|
|
* Skip them and reiterate. ser_memmem() will find next
|
|
@@ -765,6 +769,14 @@ char *find_sdp_line(char *pstart, char *plimit, char linechar)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Auxiliary for some functions - expect pstart to point inside SIP message body.
|
|
|
+ * Returns pointer to first character of found line, or NULL if no such line.
|
|
|
+ */
|
|
|
+char *find_sdp_line(char *pstart, char *plimit, char linechar)
|
|
|
+{
|
|
|
+ return find_sdp_line_start(pstart, plimit, linechar, 1);
|
|
|
+}
|
|
|
|
|
|
/* This function assumes pstart points to a line of requested type. */
|
|
|
char *find_next_sdp_line(
|