Module: kamailio
Branch: master
Commit: 12160de3c2052c4696b8c073b9fa5919f6da7060
URL: 
https://github.com/kamailio/kamailio/commit/12160de3c2052c4696b8c073b9fa5919f6da7060

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-12-09T23:27:09+01:00

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

- reported by Vasiliy Ganchev

---

Modified: parser/msg_parser.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/12160de3c2052c4696b8c073b9fa5919f6da7060.diff
Patch: 
https://github.com/kamailio/kamailio/commit/12160de3c2052c4696b8c073b9fa5919f6da7060.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);


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to