mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
v4l: If no video tuner is the requested one don't read unitialized data
This commit is contained in:
parent
334a739083
commit
d5499f5556
1 changed files with 7 additions and 15 deletions
|
@ -323,22 +323,14 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement)
|
||||||
struct video_tuner vtun;
|
struct video_tuner vtun;
|
||||||
gint n;
|
gint n;
|
||||||
|
|
||||||
for (n = 0;; n++) {
|
for (n = 0; n < vchan.tuners; n++) {
|
||||||
if (n >= vchan.tuners) {
|
|
||||||
vtun.tuner = 0; /* default */
|
|
||||||
} else {
|
|
||||||
vtun.tuner = n;
|
vtun.tuner = n;
|
||||||
if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
|
if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
|
||||||
continue; /* no more tuners */
|
continue; /* no more tuners */
|
||||||
if (strcmp (vtun.name, vchan.name) != 0) {
|
if (strcmp (vtun.name, vchan.name) != 0) {
|
||||||
continue; /* not this one */
|
continue; /* not this one */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* FIXME: in the case of n >= vchan.tuners the code below accesses
|
|
||||||
* uninitialised fields in vtun
|
|
||||||
* Not sure if the codeblock below should go into the else above, but
|
|
||||||
* then setting vtun.tuner=0 is a bit pointless.
|
|
||||||
*/
|
|
||||||
v4lchannel->tuner = n;
|
v4lchannel->tuner = n;
|
||||||
channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
|
channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
|
||||||
channel->freq_multiplicator =
|
channel->freq_multiplicator =
|
||||||
|
|
Loading…
Reference in a new issue