stream: make stream_read_line() terminate line on EOF
Make sure we return an "empty" line on eof, to make sure we get no buffer overflows in case some code fails to check the return value. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31999 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
1 parent
39e80404fa
commit
a4e62de5dc
1 file changed
+1
-1
+1
-1
@@ -620,7 +620,7 @@ unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max, int utf
|
||||
}
|
||||
s->buf_pos += len;
|
||||
} while(!end);
|
||||
if(s->eof && ptr == mem) return NULL;
|
||||
ptr[0] = 0;
|
||||
if(s->eof && ptr == mem) return NULL;
|
||||
return mem;
|
||||
}
|
||||
Reference in new issue
Block a user