summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-19 20:33:37 +0100
committerwm4 <wm4@nowhere>2014-01-19 21:15:54 +0100
commit77e92bbb11ca6f8f94df1bf2c5bad997b114f02f (patch)
tree9fbe7897225e5c35d982b6458b61e4ed055ac12f /stream
parent333a9491b7f01a1d61414f0e6ffe9d81a4acb300 (diff)
downloadmpv-77e92bbb11ca6f8f94df1bf2c5bad997b114f02f.tar.bz2
mpv-77e92bbb11ca6f8f94df1bf2c5bad997b114f02f.tar.xz
stream: treat embedded 0 bytes as error in stream_read_line
Text files should never contain these.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stream/stream.c b/stream/stream.c
index fc786ec305..ad9987fc65 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -898,7 +898,7 @@ unsigned char *stream_read_line(stream_t *s, unsigned char *mem, int max,
while (1) {
// Reserve 1 byte of ptr for terminating \0.
int l = read_characters(s, &mem[read], max - read - 1, utf16);
- if (l < 0) {
+ if (l < 0 || memchr(&mem[read], '\0', l)) {
MP_VERBOSE(s, "error reading line\n");
s->eof = false;
return NULL;