aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/gunzip.c4
-rw-r--r--gunzip.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c
index c3960e953..65f435651 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -158,9 +158,9 @@ extern int gunzip_main(int argc, char **argv)
158 158
159 delete_old_file = TRUE; 159 delete_old_file = TRUE;
160 extension = strrchr(if_name, '.'); 160 extension = strrchr(if_name, '.');
161 if (strcmp(extension, ".gz") == 0) { 161 if (extension && strcmp(extension, ".gz") == 0) {
162 length -= 3; 162 length -= 3;
163 } else if (strcmp(extension, ".tgz") == 0) { 163 } else if (extension && strcmp(extension, ".tgz") == 0) {
164 length -= 4; 164 length -= 4;
165 } else { 165 } else {
166 error_msg_and_die("Invalid extension"); 166 error_msg_and_die("Invalid extension");
diff --git a/gunzip.c b/gunzip.c
index c3960e953..65f435651 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -158,9 +158,9 @@ extern int gunzip_main(int argc, char **argv)
158 158
159 delete_old_file = TRUE; 159 delete_old_file = TRUE;
160 extension = strrchr(if_name, '.'); 160 extension = strrchr(if_name, '.');
161 if (strcmp(extension, ".gz") == 0) { 161 if (extension && strcmp(extension, ".gz") == 0) {
162 length -= 3; 162 length -= 3;
163 } else if (strcmp(extension, ".tgz") == 0) { 163 } else if (extension && strcmp(extension, ".tgz") == 0) {
164 length -= 4; 164 length -= 4;
165 } else { 165 } else {
166 error_msg_and_die("Invalid extension"); 166 error_msg_and_die("Invalid extension");