/* get tag length from stream context */
tag_len = auth_get_tag_length(stream->rtcp_auth);
- /* Validate packet length */
- if (*pkt_octet_len < (octets_in_rtcp_header + tag_len +
- sizeof(srtcp_trailer_t))) {
- return err_status_bad_param;
- }
-
/*
* set encryption start, encryption length, and trailer
*/
uint32_t seq_num;
/* we assume the hdr is 32-bit aligned to start */
+
+ /* check the packet length - it must at least contain a full header */
+ if (*pkt_octet_len < octets_in_rtcp_header)
+ return err_status_bad_param;
+
/*
* look up ssrc in srtp_stream list, and process the packet with
* the appropriate stream. if we haven't seen this stream before,
}
}
+ /* get tag length from stream context */
+ tag_len = auth_get_tag_length(stream->rtcp_auth);
+
+ /* check the packet length - it must contain at least a full RTCP
+ header, an auth tag (if applicable), and the SRTCP encrypted flag
+ and 31-bit index value */
+ if (*pkt_octet_len < (octets_in_rtcp_header + tag_len +
+ sizeof(srtcp_trailer_t)))
+ return err_status_bad_param;
+
/*
* Check if this is an AEAD stream (GCM mode). If so, then dispatch
* the request to our AEAD handler.
sec_serv_confidentiality = stream->rtcp_services == sec_serv_conf ||
stream->rtcp_services == sec_serv_conf_and_auth;
- /* get tag length from stream context */
- tag_len = auth_get_tag_length(stream->rtcp_auth);
-
/*
* set encryption start, encryption length, and trailer
*/