Module: kamailio
Branch: master
Commit: 12160de3c2052c4696b8c073b9fa5919f6da7060
URL:
https://github.com/kamailio/kamailio/commit/12160de3c2052c4696b8c073b9fa591…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
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/12160de3c2052c4696b8c073b9fa591…
Patch:
https://github.com/kamailio/kamailio/commit/12160de3c2052c4696b8c073b9fa591…
---
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);