diff options
author | David Robillard <d@drobilla.net> | 2021-07-10 15:17:09 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-07-10 15:17:09 -0400 |
commit | c05fdaa19be53ef618435d3629122a4ebdc7cb63 (patch) | |
tree | d82730a1a909007d96dd35675769b7d1de06d4ac | |
parent | acfb9ce1762d5136f846cdfb1356c0126d05f332 (diff) | |
download | serd-c05fdaa19be53ef618435d3629122a4ebdc7cb63.tar.gz serd-c05fdaa19be53ef618435d3629122a4ebdc7cb63.tar.bz2 serd-c05fdaa19be53ef618435d3629122a4ebdc7cb63.zip |
Fix out of bounds read in test
-rw-r--r-- | test/test_reader_writer.c | 4 |
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; |