From 942559d321551e93cd6bae0b03de03e7cc13042c Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Fri, 10 Oct 2025 09:40:34 +0200 Subject: zip.c: Fix endless loop on empty archives When an empty directory is to be downloaded, z->lread would always equal zero because read_file is never called. Therefore, it is more sensible not to assume any number of bytes, and just dump as much data as possible into buf. --- zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip.c b/zip.c index 5af30c2..79cf833 100644 --- a/zip.c +++ b/zip.c @@ -53,7 +53,7 @@ static void free_zip(void *const p) static int dump_final(void *const buf, const size_t n, bool *const done, void *const user, struct zip *const z) { - const ssize_t r = read(z->fds[0], buf, z->lread); + const ssize_t r = read(z->fds[0], buf, n); if (r < 0) { -- cgit v1.2.3