diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-10-10 09:40:34 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-10-10 09:40:34 +0200 |
| commit | 942559d321551e93cd6bae0b03de03e7cc13042c (patch) | |
| tree | a0e3b17567d6e5fd6f8d3f8c8f91b2d0ba69712e | |
| parent | 80d179f9fe013d727f571f4730ebbe4d228c9382 (diff) | |
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.
| -rw-r--r-- | zip.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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) { |
