Skip to content

srtpdec: fix "srtp-key" check

Michael Olbrich requested to merge mol/gstreamer:srtp-key into main

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 ad7ffe64 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.

This is basically the patch from gst-plugins-bad#754 (closed) but with a new commit message after looking at the history again.

Merge request reports