From: Tim Kientzle Date: Sat, 16 May 2026 17:04:38 +0000 (-0700) Subject: Fix unchecked strdup result in __archive_write_program_allocate X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb231e2b39b96efd815ea260de78558eb09b9841;p=thirdparty%2Flibarchive.git Fix unchecked strdup result in __archive_write_program_allocate If strdup fails, program_name would be NULL and later use could crash. Free data and return NULL on allocation failure. --- diff --git a/libarchive/archive_write_add_filter_program.c b/libarchive/archive_write_add_filter_program.c index f12db3373..cb92dc04f 100644 --- a/libarchive/archive_write_add_filter_program.c +++ b/libarchive/archive_write_add_filter_program.c @@ -184,6 +184,10 @@ __archive_write_program_allocate(const char *program) data->child_stdin = -1; data->child_stdout = -1; data->program_name = strdup(program); + if (data->program_name == NULL) { + free(data); + return (NULL); + } return (data); }