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.
#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
int fd;
gpointer data;
GstWlShmMemory *mem;
+ mode_t mask;
/* TODO: make use of the allocation params, if necessary */
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));