Skip to content

Commit

Permalink
Fixed incorrect SDP buffer length calculation (#3924)
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming authored Apr 17, 2024
1 parent c5bc3d1 commit 0d2ebdc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pjmedia/src/pjmedia/sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,9 +895,11 @@ static int print_session(const pjmedia_sdp_session *ses,
int printed;

/* Check length for v= and o= lines. */
if (len < 5+
2+ses->origin.user.slen+18+
ses->origin.net_type.slen+ses->origin.addr.slen + 2)
if (len < 5 + 2 + ses->origin.user.slen +
20 + 20 + 3 + /* max digits of origin.id and version +
* whitespaces */
ses->origin.net_type.slen + ses->origin.addr_type.slen +
ses->origin.addr.slen + 2 + 2)
{
return -1;
}
Expand Down Expand Up @@ -959,7 +961,7 @@ static int print_session(const pjmedia_sdp_session *ses,
}

/* Time */
if ((end-p) < 24) {
if ((end-p) < 2+20+1+20+2) {
return -1;
}
*p++ = 't';
Expand Down

0 comments on commit 0d2ebdc

Please sign in to comment.