From c05fdaa19be53ef618435d3629122a4ebdc7cb63 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 10 Jul 2021 15:17:09 -0400 Subject: Fix out of bounds read in test --- test/test_reader_writer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index 233a3871..8bd09fe2 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -82,6 +82,10 @@ eof_test_read(void* buf, size_t size, size_t nmemb, void* stream) return 0; } + if (*count >= strlen(string)) { + return 0; + } + // Normal reading after the EOF, adjusting for the skipped index 35 *(char*)buf = string[*count - 1]; ++*count; -- cgit v1.2.1