]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
warc: Ignore separator when reaching end of entry
authorTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 3 Jun 2025 19:57:42 +0000 (21:57 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 3 Jun 2025 19:57:42 +0000 (21:57 +0200)
When _warc_read encounters end of entry, it adds 4 bytes to the last
offset for \r\n\r\n separator, which is never written. Ignore these
bytes since they are not part of the returned entry.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read_support_format_warc.c

index 696f959c341dc9c9c317ad6103c5a0f71862a137..d8f188cf0b44909e0803a9f82a2cab27f9ae2f0f 100644 (file)
@@ -405,7 +405,7 @@ _warc_read(struct archive_read *a, const void **buf, size_t *bsz, int64_t *off)
                /* it's our lucky day, no work, we can leave early */
                *buf = NULL;
                *bsz = 0U;
-               *off = w->cntoff + 4U/*for \r\n\r\n separator*/;
+               *off = w->cntoff;
                w->unconsumed = 0U;
                return (ARCHIVE_EOF);
        }