Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
xawtv
v4l-conf-fix-CVE-2020-13696.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File v4l-conf-fix-CVE-2020-13696.patch of Package xawtv
From 31f31f9cbaee7be806cba38e0ff5431bd44b20a3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Date: Sat, 16 May 2020 01:22:07 +0200 Subject: [PATCH 1/3] v4l-conf: check file type before opening it Let's avoid open the file if it doesn't exist or it is not a file of the right type. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> --- console/v4l-conf.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) Index: xawtv-3.103/console/v4l-conf.c =================================================================== --- xawtv-3.103.orig/console/v4l-conf.c +++ xawtv-3.103/console/v4l-conf.c @@ -134,20 +134,23 @@ dev_open(const char *device, int major) exit(1); } - /* open & check v4l device */ - if (-1 == (fd = open(device,O_RDWR))) { - fprintf(stderr, "can't open %s: %s\n", device, strerror(errno)); + /* First check if the device is really a devnode of the right type */ + if (-1 == stat(device, &stb)) { + fprintf(stderr, "invalid path or file is not of the right type %s\n", device); exit(1); } - if (-1 == fstat(fd,&stb)) { - fprintf(stderr, "fstat(%s): %s\n", device, strerror(errno)); + if (!S_ISCHR(stb.st_mode) || (major(stb.st_rdev) != major)) { + fprintf(stderr, "invalid path or file is not of the right type %s\n", device); exit(1); } - if (!S_ISCHR(stb.st_mode) || (major(stb.st_rdev) != major)) { - fprintf(stderr, "%s: wrong device\n", device); + + /* Then open it */ + if (-1 == (fd = open(device,O_RDWR))) { + fprintf(stderr, "can't open %s: %s\n", device, strerror(errno)); exit(1); } + return fd; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor