summaryrefslogtreecommitdiff
path: root/archival/gunzip.c
diff options
context:
space:
mode:
authorMatt Kraai2001-04-18 15:51:45 +0000
committerMatt Kraai2001-04-18 15:51:45 +0000
commit54652230d4f22f17a00a96493721c0688c838cd0 (patch)
tree5f2c270b682b9ca23b02cf41ae0a3d9dec1cf33f /archival/gunzip.c
parentb181056e06974e72f210189bf758d76dc2ecdde6 (diff)
downloadbusybox-54652230d4f22f17a00a96493721c0688c838cd0.zip
busybox-54652230d4f22f17a00a96493721c0688c838cd0.tar.gz
Eliminate a segfault when called on an existing file with out an extension:
touch foo && gunzip foo
Diffstat (limited to 'archival/gunzip.c')
-rw-r--r--archival/gunzip.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c
index c3960e9..65f4356 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -158,9 +158,9 @@ extern int gunzip_main(int argc, char **argv)
delete_old_file = TRUE;
extension = strrchr(if_name, '.');
- if (strcmp(extension, ".gz") == 0) {
+ if (extension && strcmp(extension, ".gz") == 0) {
length -= 3;
- } else if (strcmp(extension, ".tgz") == 0) {
+ } else if (extension && strcmp(extension, ".tgz") == 0) {
length -= 4;
} else {
error_msg_and_die("Invalid extension");