Skip to content

Commit

Permalink
Bug 1216837: add explicit error checks for packet length in srtp r=mc…
Browse files Browse the repository at this point in the history
…manus rs=jesup
  • Loading branch information
jesup committed Dec 5, 2015
1 parent 7742360 commit a94574d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions netwerk/srtp/src/srtp/srtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,8 @@ srtp_stream_init(srtp_stream_ctx_t *srtp,
srtp_hdr_xtnd_t *xtn_hdr = (srtp_hdr_xtnd_t *)enc_start;
enc_start += (ntohs(xtn_hdr->length) + 1);
}
if (!((uint8_t*)enc_start <= (uint8_t*)hdr + *pkt_octet_len))
return err_status_parse_err;
enc_octet_len = (unsigned int)(*pkt_octet_len
- ((enc_start - (uint32_t *)hdr) << 2));
} else {
Expand Down Expand Up @@ -1076,6 +1078,8 @@ srtp_unprotect(srtp_ctx_t *ctx, void *srtp_hdr, int *pkt_octet_len) {
srtp_hdr_xtnd_t *xtn_hdr = (srtp_hdr_xtnd_t *)enc_start;
enc_start += (ntohs(xtn_hdr->length) + 1);
}
if (!((uint8_t*)enc_start < (uint8_t*)hdr + (*pkt_octet_len - tag_len)))
return err_status_parse_err;
enc_octet_len = (uint32_t)(*pkt_octet_len - tag_len
- ((enc_start - (uint32_t *)hdr) << 2));
} else {
Expand Down

0 comments on commit a94574d

Please sign in to comment.