Skip to content

Commit

Permalink
sdpops: safety check when location a= line not to exceed end of message
Browse files Browse the repository at this point in the history
(cherry picked from commit 9159695)
  • Loading branch information
miconda committed Feb 23, 2015
1 parent 449ba0c commit e24c9ff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/sdpops/sdpops_mod.c
Expand Up @@ -156,12 +156,17 @@ static int mod_init(void)
int sdp_locate_line(sip_msg_t* msg, char *pos, str *aline)
{
char *p;
char *bend;

p = pos;
while(*p!='\n') p--;
aline->s = p + 1;
p = pos;
while(*p!='\n') p++;
bend = msg->buf+msg->len;
while(*p!='\n' && p<bend) p++;
aline->len = p - aline->s + 1;
if(unlikely(p==bend)) aline->len--;

return 0;
}

Expand Down

0 comments on commit e24c9ff

Please sign in to comment.