changeset 33429:2e2a56ca2d0b

Only accept regular files as .bin files for .cue files. In particular avoids trying to use directories as .bin when e.g. we failed to extract a filename.
author reimar
date Sun, 29 May 2011 11:56:11 +0000
parents 043d9e61e043
children a1184b9d68de
files stream/stream_cue.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_cue.c	Sun May 29 11:47:18 2011 +0000
+++ b/stream/stream_cue.c	Sun May 29 11:56:11 2011 +0000
@@ -172,6 +172,7 @@
  * sure the sizes are in sync.
  */
 static int cue_find_bin (const char *firstline) {
+  struct stat filestat;
   const char *cur_name;
   char bin_filename[256];
   char s[256];
@@ -246,6 +247,10 @@
       break;
     }
     fd_bin = open(cur_name, O_RDONLY);
+    if (fstat(fd_bin, &filestat) == -1 || !S_ISREG(filestat.st_mode)) {
+        close(fd_bin);
+        fd_bin = -1;
+    }
     if (fd_bin == -1) {
       mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_MPDEMUX_CUEREAD_BinFilenameTested,
             cur_name);