From: Colin Leroy Date: Thu, 8 Oct 2015 16:59:49 +0000 (+0200) Subject: Fix TOCTOU (time-to-check, time-to-use) race X-Git-Tag: 3.13.0~18 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=9af27fcb9c07d0118dd1986a23a9d04b3c5acc71 Fix TOCTOU (time-to-check, time-to-use) race --- diff --git a/src/plugins/archive/libarchive_archive.c b/src/plugins/archive/libarchive_archive.c index 928c8eb44..f0ae67b64 100644 --- a/src/plugins/archive/libarchive_archive.c +++ b/src/plugins/archive/libarchive_archive.c @@ -551,11 +551,11 @@ const gchar* archive_create(const char* archive_name, GSList* files, g_free(msg); #endif entry = archive_entry_new(); - lstat(filename, &st); if ((fd = open(filename, O_RDONLY)) == -1) { perror("open file"); } else { + lstat(filename, &st); archive_entry_copy_stat(entry, &st); archive_entry_set_pathname(entry, filename); if (S_ISLNK(st.st_mode)) {