From bed5a7bb0a1e2d7b29c0cd6d7354bfe419a02279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martti=20Rannanj=C3=A4rvi?= Date: Mon, 2 Dec 2024 01:33:48 +0200 Subject: [PATCH] formats: Do not use memcpy with NULL source or destination in memread_buf() --- src/formats/internal/memreader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);