summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2022-12-31 21:28:26 -0800
committerMark Adler <madler@alumni.caltech.edu>2022-12-31 21:28:26 -0800
commite1ed230a1599a3cb64c8f5c003cced60e10e3314 (patch)
tree704519b22aad615b15c2438a743495231f39c3b9
parente9c0bbbc4f6710c4e19dd1c3b4b6405116ce26d0 (diff)
downloadpigz-e1ed230a1599a3cb64c8f5c003cced60e10e3314.tar.gz
Avoid calling memcpy() with a NULL pointer.
This is not permitted by the C99 standard even when the length is zero. Go figure.
-rw-r--r--pigz.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pigz.c b/pigz.c
index e1c60b6..a9b0f2f 100644
--- a/pigz.c
+++ b/pigz.c
@@ -3414,8 +3414,10 @@ local int outb(void *desc, unsigned char *buf, unsigned len) {
// copy the output and alert the worker bees
out_len = len;
- g.out_tot += len;
- memcpy(out_copy, buf, len);
+ if (len) {
+ g.out_tot += len;
+ memcpy(out_copy, buf, len);
+ }
twist(outb_write_more, TO, 1);
twist(outb_check_more, TO, 1);