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);