]> 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:12:24 +0000 (21:12 +0000)
committerJoshua Colp <jcolp@digium.com>
Fri, 4 Jan 2013 21:12:24 +0000 (21:12 +0000)
(closes issue AST-1036)
Reported by: jbigelow

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

res/res_rtp_asterisk.c

index 3528d58ec6cb63e6e1bef5e986c8279cda54d3a7..2d27f1f296157a99208b66b76597b893dac87872 100644 (file)
@@ -360,12 +360,13 @@ 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;
        }
 
-       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;
        }