From 228c00cc535f1703041e582b570c519f71437641 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Tue, 26 Dec 2017 17:20:45 -0800 Subject: [PATCH] Disallow an empty suffix. An empty suffix with forced compression would result in both the original and compressed file being deleted. --- pigz.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pigz.c b/pigz.c index 743f24e..e0dff35 100644 --- a/pigz.c +++ b/pigz.c @@ -4263,8 +4263,11 @@ local int option(char *arg) { throw(EINVAL, "compiled without threads"); #endif } - else if (get == 3) + else if (get == 3) { + if (*arg == 0) + throw(EINVAL, "suffix cannot be empty"); g.sufx = arg; // gz suffix + } #ifndef NOZOPFLI else if (get == 4) g.zopts.numiterations = (int)num(arg); // optimize iterations