]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_asterisk.c: Check RTP packet version earlier.
authorRichard Mudgett <rmudgett@digium.com>
Fri, 25 Aug 2017 22:05:06 +0000 (17:05 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 5 Sep 2017 19:46:40 +0000 (14:46 -0500)
Change-Id: Ic6493a7d79683f3e5845dff1cee49445fd5a0adf

res/res_rtp_asterisk.c

index fa0baf21ad54f8d993713a83783d9fe3071d49ad..acc61c7e52d2df48c79af2b0fe33bb4b336803b3 100644 (file)
@@ -5069,6 +5069,11 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
                return &ast_null_frame;
        }
 
+       /* If the version is not what we expected by this point then just drop the packet */
+       if (version != 2) {
+               return &ast_null_frame;
+       }
+
        /* If strict RTP protection is enabled see if we need to learn the remote address or if we need to drop the packet */
        if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
                if (!ast_sockaddr_cmp(&rtp->strict_rtp_address, &addr)) {
@@ -5115,11 +5120,6 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
                }
        }
 
-       /* If the version is not what we expected by this point then just drop the packet */
-       if (version != 2) {
-               return &ast_null_frame;
-       }
-
        /* Pull out the various other fields we will need */
        payloadtype = (seqno & 0x7f0000) >> 16;
        padding = seqno & (1 << 29);