From dd29550649868339720ad06a41c94ba68b683572 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 30 Sep 2024 15:45:48 +0900 Subject: [PATCH] Fix v1 archive decompression Previous implementation sent too many bytes to decompressor if size was less than 1024. --- src/archiver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/archiver.c b/src/archiver.c index 6952120..429b85d 100644 --- a/src/archiver.c +++ b/src/archiver.c @@ -2570,8 +2570,10 @@ int simple_archiver_parse_archive_version_1(FILE *in_f, int_fast8_t do_extract, fprintf(stderr, "ERROR Failed to read chunk for decompressing!\n"); return SDAS_INTERNAL_ERROR; } - ssize_t write_ret = write(pipe_into_cmd[1], buf, 1024); - if (write_ret > 0 && (size_t)write_ret == 1024) { + ssize_t write_ret = + write(pipe_into_cmd[1], buf, chunk_size - chunk_written); + if (write_ret > 0 && + (size_t)write_ret == chunk_size - chunk_written) { // Successful write. } else if (write_ret == -1) { fprintf(stderr,