changeset 33428:043d9e61e043

Ensure 0-termination even if line does not start with FILE " Part of patch by Ivan Kalvachev [ikalvachev gmail com].
author reimar
date Sun, 29 May 2011 11:47:18 +0000
parents ebee3b6ab9ce
children 2e2a56ca2d0b
files stream/stream_cue.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_cue.c	Sun May 29 11:45:47 2011 +0000
+++ b/stream/stream_cue.c	Sun May 29 11:47:18 2011 +0000
@@ -173,11 +173,11 @@
  */
 static int cue_find_bin (const char *firstline) {
   const char *cur_name;
-  int i;
   char bin_filename[256];
   char s[256];
   char t[256];
   int fd_bin;
+  int i = 0;
 
   /* get the filename out of that */
   /*                      12345 6  */
@@ -185,7 +185,6 @@
   if (strncmp(firstline, "FILE \"",6)==0)
   {
     firstline += 6;
-    i = 0;
     while ( *firstline && *firstline != '"')
     {
       bin_filename[i] = *firstline++;
@@ -205,9 +204,8 @@
           i++;
       }
     }
-    bin_filename[i] = '\0';
-
   }
+  bin_filename[i] = '\0';
 
   fd_bin = -1;
   for (i = 0; fd_bin == -1 && i < 6; i++) {