diff options
author | David Robillard <d@drobilla.net> | 2018-05-10 15:31:22 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-06-10 19:57:44 +0000 |
commit | e3a491db47da8ae03d6390e71652ca53779fb393 (patch) | |
tree | 83e87c0400b575bf42738e7136ae58df2d17fb22 /src/reader.c | |
parent | d208424fdb4e8b516aff2a5a0d03fc7411909471 (diff) | |
download | serd-e3a491db47da8ae03d6390e71652ca53779fb393.tar.gz serd-e3a491db47da8ae03d6390e71652ca53779fb393.tar.bz2 serd-e3a491db47da8ae03d6390e71652ca53779fb393.zip |
Fix byte source to never read past end of strings
Diffstat (limited to 'src/reader.c')
-rw-r--r-- | src/reader.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/reader.c b/src/reader.c index d515aaab..e9210927 100644 --- a/src/reader.c +++ b/src/reader.c @@ -348,16 +348,12 @@ serd_reader_read_chunk(SerdReader* reader) { SerdStatus st = SERD_SUCCESS; if (!reader->source.prepared) { - if ((st = serd_reader_prepare(reader))) { - return st; - } + st = serd_reader_prepare(reader); } else if (reader->source.eof) { - reader->source.eof = false; - if ((st = serd_byte_source_advance(&reader->source))) { - return st; - } + st = serd_byte_source_advance(&reader->source); } - return read_statement(reader) ? SERD_SUCCESS : SERD_FAILURE; + + return st ? st : read_statement(reader) ? SERD_SUCCESS : SERD_FAILURE; } SERD_API |