]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't pass STUN packets through the SRTP unprotect function.
authorJoshua Colp <jcolp@digium.com>
Fri, 4 Jan 2013 21:16:32 +0000 (21:16 +0000)
committerJoshua Colp <jcolp@digium.com>
Fri, 4 Jan 2013 21:16:32 +0000 (21:16 +0000)
(closes issue AST-1036)
Reported by: jbigelow
........

Merged revisions 378553 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@378555 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_rtp_asterisk.c

index a5ae99e318fd37ab426d116b71d2f4973d1a2f12..43ea2229d1195aa7818cc5e75e8ac06508242053 100644 (file)
@@ -1377,6 +1377,7 @@ static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t s
        int len;
        struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
        struct ast_srtp *srtp = ast_rtp_instance_get_srtp(instance);
+       char *in = buf;
 
        if ((len = ast_recvfrom(rtcp ? rtp->rtcp->s : rtp->s, buf, size, flags, sa)) < 0) {
           return len;
@@ -1384,8 +1385,6 @@ static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t s
 
 #ifdef HAVE_OPENSSL_SRTP
        if (!rtcp) {
-               char *in = buf;
-
                dtls_srtp_check_pending(instance, rtp);
 
                /* If this is an SSL packet pass it to OpenSSL for processing */
@@ -1458,7 +1457,7 @@ static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t s
                rtp->passthrough = 0;
        }
 
-       if (res_srtp && srtp && res_srtp->unprotect(srtp, buf, &len, rtcp) < 0) {
+       if ((*in > 1) && res_srtp && srtp && res_srtp->unprotect(srtp, buf, &len, rtcp) < 0) {
           return -1;
        }