Browse code

core: skip zero char and whitespaces before parsing first line in parse_msg()

- reported by Vasiliy Ganchev

(cherry picked from commit 12160de3c2052c4696b8c073b9fa5919f6da7060)
(cherry picked from commit 8807dbc93a3731cb51a979158433fc28ff0c04ee)

Daniel-Constantin Mierla authored on 09/12/2015 22:27:09
Showing 1 changed files
... ...
@@ -606,9 +606,11 @@ int parse_msg(char* const buf, const unsigned int len, struct sip_msg* const msg
606 606
 	int offset;
607 607
 	hdr_flags_t flags;
608 608
 
609
-	/* eat crlf from the beginning */
610
-	for (tmp=buf; (*tmp=='\n' || *tmp=='\r')&&
611
-			tmp-buf < len ; tmp++);
609
+	/* eat crlf & whitespaces from the beginning */
610
+	for (tmp=buf; (tmp-buf < len)
611
+			&& (*tmp=='\n' || *tmp=='\r' || *tmp=='\0'
612
+				|| *tmp=='\t' || *tmp==' ');
613
+			tmp++);
612 614
 	offset=tmp-buf;
613 615
 	fl=&(msg->first_line);
614 616
 	rest=parse_first_line(tmp, len-offset, fl);