# HG changeset patch # User reimar # Date 1282385258 0 # Node ID d0d09a75bb17428efa061e5ba077ce9c748c3bf6 # Parent 6b45e5fb9dc432be994d1044b00ac6099d52c2ac 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. diff -r 6b45e5fb9dc4 -r d0d09a75bb17 stream/stream_bd.c --- a/stream/stream_bd.c Sat Aug 21 10:02:50 2010 +0000 +++ b/stream/stream_bd.c Sat Aug 21 10:07:38 2010 +0000 @@ -143,6 +143,7 @@ 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 @@ 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