diff options
author | Luis de Bethencourt <luis.bg@samsung.com> | 2015-03-03 15:51:50 +0000 |
---|---|---|
committer | Luis de Bethencourt <luis.bg@samsung.com> | 2015-03-03 15:51:55 +0000 |
commit | 1890e7355a5464fcfff58633851265b3fc7a3731 (patch) | |
tree | 67a748f266c372700ce06dd75a5d1ee1eed079c0 /ext/wayland | |
parent | 4521524de37f50812acb33a147fe61d1a0d0a364 (diff) | |
download | gstreamer-plugins-bad-1890e7355a5464fcfff58633851265b3fc7a3731.tar.gz |
waylandsink: mkstemp requires setting permission mask
Using mkstemp without setting the permission mask is potentially harmful.
POSIX specification of mkstemp() does not say anything about file modes, so we
need to make sure its file mode creation mask is set appropriately before
calling it.
Diffstat (limited to 'ext/wayland')
-rw-r--r-- | ext/wayland/wlshmallocator.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/wayland/wlshmallocator.c b/ext/wayland/wlshmallocator.c index 183795c3b..f36811f18 100644 --- a/ext/wayland/wlshmallocator.c +++ b/ext/wayland/wlshmallocator.c @@ -30,6 +30,7 @@ #include <unistd.h> #include <sys/mman.h> #include <sys/types.h> +#include <sys/stat.h> GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug); #define GST_CAT_DEFAULT gstwayland_debug @@ -46,6 +47,7 @@ gst_wl_shm_allocator_alloc (GstAllocator * allocator, gsize size, int fd; gpointer data; GstWlShmMemory *mem; + mode_t mask; /* TODO: make use of the allocation params, if necessary */ @@ -53,7 +55,9 @@ gst_wl_shm_allocator_alloc (GstAllocator * allocator, gsize size, snprintf (filename, 1024, "%s/%s-%d-%s", g_get_user_runtime_dir (), "wayland-shm", init++, "XXXXXX"); + mask = umask (S_IRWXO | S_IRWXG); fd = mkstemp (filename); + umask (mask); if (fd < 0) { GST_ERROR_OBJECT (self, "opening temp file %s failed: %s", filename, strerror (errno)); |