Skip to content

Commit

Permalink
Fixed length check for RTCP FB SLI and RPSI parsing (#4069)
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming authored Sep 11, 2024
1 parent 9b6744f commit f67e3ed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pjmedia/src/pjmedia/rtcp_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,8 @@ PJ_DEF(pj_status_t) pjmedia_rtcp_fb_parse_sli(
return PJ_ETOOSMALL;
}

cnt = pj_ntohs((pj_uint16_t)hdr->rtcp_common.length) - 2;
cnt = pj_ntohs((pj_uint16_t)hdr->rtcp_common.length);
if (cnt > 2) cnt -= 2; else cnt = 0;
if (length < (cnt+3)*4)
return PJ_ETOOSMALL;

Expand Down Expand Up @@ -755,7 +756,9 @@ PJ_DEF(pj_status_t) pjmedia_rtcp_fb_parse_rpsi(
return PJ_ETOOSMALL;
}

rpsi_len = (pj_ntohs((pj_uint16_t)hdr->rtcp_common.length)-2) * 4;
rpsi_len = pj_ntohs((pj_uint16_t)hdr->rtcp_common.length);
if (rpsi_len > 2) rpsi_len -= 2; else rpsi_len = 0;
rpsi_len *= 4;
if (length < rpsi_len + 12)
return PJ_ETOOSMALL;

Expand Down

0 comments on commit f67e3ed

Please sign in to comment.