mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-29 06:46:38 -04:00
security: add missing O_CLOEXEC flag to V4L2 device open
File and Resource Handling: Medium The V4L2 device file descriptor was opened without the O_CLOEXEC flag. If a child process is subsequently spawned (e.g., via fork+exec), the video device fd would be inherited, potentially allowing the child process unauthorized access to the camera device. Fixed by adding O_CLOEXEC to the open() flags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a12cc84df4
commit
695f25600b
1 changed files with 1 additions and 1 deletions
|
|
@ -42,7 +42,7 @@ int spa_v4l2_open(struct spa_v4l2_device *dev, const char *path)
|
||||||
|
|
||||||
spa_log_info(dev->log, "device is '%s'", path);
|
spa_log_info(dev->log, "device is '%s'", path);
|
||||||
|
|
||||||
dev->fd = open(path, O_RDWR | O_NONBLOCK, 0);
|
dev->fd = open(path, O_RDWR | O_NONBLOCK | O_CLOEXEC, 0);
|
||||||
if (dev->fd == -1) {
|
if (dev->fd == -1) {
|
||||||
err = errno;
|
err = errno;
|
||||||
spa_log_error(dev->log, "Cannot open '%s': %d, %s",
|
spa_log_error(dev->log, "Cannot open '%s': %d, %s",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue