diff --git a/src/formats/internal/memreader.c b/src/formats/internal/memreader.c index 5ea3bd88b..b432ec92f 100644 --- a/src/formats/internal/memreader.c +++ b/src/formats/internal/memreader.c @@ -49,7 +49,7 @@ void memreader_close(memreader *reader) { } int memread_buf(memreader *reader, char *buf, int len) { - if(reader->pos + len > reader->len) { + if(reader->pos + len > reader->len || buf == NULL || reader->buf == NULL) { return 0; } memcpy(buf, reader->buf + reader->pos, len);