Skip to content

Commit

Permalink
core: skip zero char and whitespaces before parsing first line in par…
Browse files Browse the repository at this point in the history
…se_msg()

- reported by Vasiliy Ganchev
  • Loading branch information
miconda committed Dec 9, 2015
1 parent 01060e9 commit 12160de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions parser/msg_parser.c
Expand Up @@ -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);
Expand Down

0 comments on commit 12160de

Please sign in to comment.