srtpdec: fix "srtp-key" check
authorMichael Olbrich <m.olbrich@pengutronix.de>
Thu, 19 Jul 2018 15:21:22 +0000 (17:21 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 14 Apr 2023 06:51:34 +0000 (06:51 +0000)
commitcb2dcf40b9be38b6d966b597cf11af029ff875f6
treeaf901a744288e3433434cc15c5b3055ff2c25172
parenta921e40228a2190715b6ba2b1fb4a4b6deb7ede9
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4423>
subprojects/gst-plugins-bad/ext/srtp/gstsrtpdec.c