From 77e92bbb11ca6f8f94df1bf2c5bad997b114f02f Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 19 Jan 2014 20:33:37 +0100 Subject: stream: treat embedded 0 bytes as error in stream_read_line Text files should never contain these. --- stream/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stream/stream.c') 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; -- cgit v1.2.3