[MPlayer-cvslog] r31998 - trunk/stream/stream_bd.c

reimar subversion at mplayerhq.hu
Sat Aug 21 12:07:38 CEST 2010


Author: reimar
Date: Sat Aug 21 12:07:38 2010
New Revision: 31998

Log:
Check stream_read_line result instead of checking stream_eof,
checking stream_eof in the previous way would process the
last line twice or even use uninitialized data in case of
and empty file.

Modified:
   trunk/stream/stream_bd.c

Modified: trunk/stream/stream_bd.c
==============================================================================
--- trunk/stream/stream_bd.c	Sat Aug 21 12:02:50 2010	(r31997)
+++ trunk/stream/stream_bd.c	Sat Aug 21 12:07:38 2010	(r31998)
@@ -143,6 +143,7 @@ static void id2str(const uint8_t *id, in
 
 static int find_vuk(struct bd_priv *bd, const uint8_t discid[20])
 {
+    char line[1024];
     char filename[PATH_MAX];
     const char *home;
     int vukfound = 0;
@@ -159,11 +160,9 @@ static int find_vuk(struct bd_priv *bd, 
         return 0;
     }
     id2str(discid, 20, idstr);
-    while (!stream_eof(file)) {
-        char line[1024];
+    while (stream_read_line(file, line, sizeof(line), 0)) {
         char *vst;
 
-        stream_read_line(file, line, sizeof(line), 0);
         // file is built up this way:
         // DISCID = title | V | VUK
         // or


More information about the MPlayer-cvslog mailing list