diff options
author | Martin Matuska <mm@FreeBSD.org> | 2025-10-16 17:36:33 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2025-10-16 17:41:19 +0000 |
commit | 8f38cbcd9c4a4f27bdccf2e75a7e20026cff5181 (patch) | |
tree | d6d99051589c097001ba225066098ae579a57bcc /libarchive/archive_entry_stat.c | |
parent | 76141d3306dea42228646b9a4a5e97ccba59fe2a (diff) |
Diffstat (limited to 'libarchive/archive_entry_stat.c')
-rw-r--r-- | libarchive/archive_entry_stat.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libarchive/archive_entry_stat.c b/libarchive/archive_entry_stat.c index c4906838ed0f..345d3d29b2f2 100644 --- a/libarchive/archive_entry_stat.c +++ b/libarchive/archive_entry_stat.c @@ -38,6 +38,7 @@ const struct stat * archive_entry_stat(struct archive_entry *entry) { + int64_t size; struct stat *st; if (entry->stat == NULL) { entry->stat = calloc(1, sizeof(*st)); @@ -74,7 +75,10 @@ archive_entry_stat(struct archive_entry *entry) st->st_ino = (ino_t)archive_entry_ino64(entry); st->st_nlink = archive_entry_nlink(entry); st->st_rdev = archive_entry_rdev(entry); - st->st_size = (off_t)archive_entry_size(entry); + size = archive_entry_size(entry); + st->st_size = (off_t)size; + if (st->st_size < 0 || (int64_t)st->st_size != size) + st->st_size = 0; st->st_mode = archive_entry_mode(entry); /* |