From fe6b76c64ea7c68c9bbb42fce1074f28b7b16e20 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Thu, 19 Jul 2018 17:21:22 +0200 Subject: [PATCH] srtpdec: fix "srtp-key" check The original code was: if (!gst_structure_get (s, "srtp-key", GST_TYPE_BUFFER, &buf, NULL) || !buf) { goto error; } else { stream->key = buf; } So use "srtp-key" if it is set so a non NULL buffer. The condition was incorrectly inverted in ad7ffe64a66ab48d81671651031c449149db4973 to: if (gst_structure_get (s, "srtp-key", GST_TYPE_BUFFER, &buf, NULL) || !buf) { stream->key = buf; } ... Fix the condition so it works as originally intended and avoid accessing 'buf' uninitialised. Part-of: --- subprojects/gst-plugins-bad/ext/srtp/gstsrtpdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/ext/srtp/gstsrtpdec.c b/subprojects/gst-plugins-bad/ext/srtp/gstsrtpdec.c index 4d03feb90c..94abbf1076 100644 --- a/subprojects/gst-plugins-bad/ext/srtp/gstsrtpdec.c +++ b/subprojects/gst-plugins-bad/ext/srtp/gstsrtpdec.c @@ -606,7 +606,7 @@ get_stream_from_caps (GstSrtpDec * filter, GstCaps * caps, guint32 ssrc) goto error; } - if (gst_structure_get (s, "srtp-key", GST_TYPE_BUFFER, &buf, NULL) || !buf) { + if (gst_structure_get (s, "srtp-key", GST_TYPE_BUFFER, &buf, NULL) && buf) { #ifdef HAVE_SRTP2 GstBuffer *mki = NULL; guint i;