Mercurial > mplayer.hg
changeset 31917:d0d09a75bb17
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.
author | reimar |
---|---|
date | Sat, 21 Aug 2010 10:07:38 +0000 |
parents | 6b45e5fb9dc4 |
children | 3103448dcf28 |
files | stream/stream_bd.c |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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