aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-10 15:17:09 -0400
committerDavid Robillard <d@drobilla.net>2021-07-10 15:17:09 -0400
commitc05fdaa19be53ef618435d3629122a4ebdc7cb63 (patch)
treed82730a1a909007d96dd35675769b7d1de06d4ac /test
parentacfb9ce1762d5136f846cdfb1356c0126d05f332 (diff)
downloadserd-c05fdaa19be53ef618435d3629122a4ebdc7cb63.tar.gz
serd-c05fdaa19be53ef618435d3629122a4ebdc7cb63.tar.bz2
serd-c05fdaa19be53ef618435d3629122a4ebdc7cb63.zip
Fix out of bounds read in test
Diffstat (limited to 'test')
-rw-r--r--test/test_reader_writer.c4
1 files changed, 4 insertions, 0 deletions
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;