From 1d4426e83412695caa5ec1b9de0e02535180c819 Mon Sep 17 00:00:00 2001 From: moritz Date: Sat, 10 Mar 2007 21:23:15 +0000 Subject: [PATCH] Do not execute group-/world-writeable playlist and metadata scripts. git-svn-id: https://svn.xiph.org/trunk/ezstream@12712 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- NEWS | 1 + src/metadata.c | 6 ++++++ src/playlist.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/NEWS b/NEWS index b0e9225..b996dc7 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ Changes in 0.4.0, (SVN trunk): * src/playlist.*: - [FIX] An error compareable to the one about xfree() in src/util.* has been fixed. + - [MISC] Refuse to execute a group- or world-writeable playlist script. * src/compat.c: - [ADD] Implement a basename() function for Windows that behaves like the diff --git a/src/metadata.c b/src/metadata.c index d8a6d23..4334529 100644 --- a/src/metadata.c +++ b/src/metadata.c @@ -364,6 +364,12 @@ metadata_program(const char *program) metadata_free(&md); return (NULL); } + if (st.st_mode & (S_IWGRP | S_IWOTH)) { + printf("%s: Error: %s is group and/or world writeable\n", + __progname, program); + metadata_free(&md); + return (NULL); + } if (!(st.st_mode & (S_IEXEC | S_IXGRP | S_IXOTH))) { printf("%s: %s: Not an executable program\n", __progname, program); metadata_free(&md); diff --git a/src/playlist.c b/src/playlist.c index 0118e92..e898742 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -218,6 +218,12 @@ playlist_program(const char *filename) playlist_free(&pl); return (NULL); } + if (st.st_mode & (S_IWGRP | S_IWOTH)) { + printf("%s: Error: %s is group and/or world writeable\n", + __progname, filename); + playlist_free(&pl); + return (NULL); + } if (!(st.st_mode & (S_IEXEC | S_IXGRP | S_IXOTH))) { printf("%s: %s: Not an executable program\n", __progname, filename); playlist_free(&pl);