[sr-dev] git:4.3:8807dbc9: core: skip zero char and whitespaces before parsing first line in parse_msg()

Daniel-Constantin Mierla miconda at gmail.com
Thu Dec 17 09:39:33 CET 2015


Module: kamailio
Branch: 4.3
Commit: 8807dbc93a3731cb51a979158433fc28ff0c04ee
URL: https://github.com/kamailio/kamailio/commit/8807dbc93a3731cb51a979158433fc28ff0c04ee

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-12-17T09:36:58+01:00

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

- reported by Vasiliy Ganchev

(cherry picked from commit 12160de3c2052c4696b8c073b9fa5919f6da7060)

---

Modified: parser/msg_parser.c

---

Diff:  https://github.com/kamailio/kamailio/commit/8807dbc93a3731cb51a979158433fc28ff0c04ee.diff
Patch: https://github.com/kamailio/kamailio/commit/8807dbc93a3731cb51a979158433fc28ff0c04ee.patch

---

diff --git a/parser/msg_parser.c b/parser/msg_parser.c
index b907772..21b3cc2 100644
--- a/parser/msg_parser.c
+++ b/parser/msg_parser.c
@@ -589,9 +589,11 @@ int parse_msg(char* const buf, const unsigned int len, struct sip_msg* const msg
 	int offset;
 	hdr_flags_t flags;
 
-	/* eat crlf from the beginning */
-	for (tmp=buf; (*tmp=='\n' || *tmp=='\r')&&
-			tmp-buf < len ; tmp++);
+	/* eat crlf & whitespaces from the beginning */
+	for (tmp=buf; (tmp-buf < len)
+			&& (*tmp=='\n' || *tmp=='\r' || *tmp=='\0'
+				|| *tmp=='\t' || *tmp==' ');
+			tmp++);
 	offset=tmp-buf;
 	fl=&(msg->first_line);
 	rest=parse_first_line(tmp, len-offset, fl);




More information about the sr-dev mailing list