From bbfed75599924e00579e8428e93d9135c2e6d9b6 Mon Sep 17 00:00:00 2001 From: xjdeng Date: Wed, 22 Oct 2025 19:57:20 +0800 Subject: [PATCH] Fix strdup failed --- src/zipcmp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zipcmp.c b/src/zipcmp.c index 536e9b217..06dba86b5 100644 --- a/src/zipcmp.c +++ b/src/zipcmp.c @@ -419,6 +419,10 @@ list_directory(const char *name, struct archive *a) { } normalized_name = strdup(name); + if (normalized_name == NULL) { + fprintf(stderr, "%s: malloc failure\n", progname); + exit(1); + } while (name_length > 0 && normalized_name[name_length-1] == '/') { name_length -= 1;