41 lines
1.4 KiB
Diff
41 lines
1.4 KiB
Diff
From e5b45f861a4d5738679f37d46ebca6e171bb3212 Mon Sep 17 00:00:00 2001
|
|
From: Colin Walters <walters@verbum.org>
|
|
Date: Mon, 4 Apr 2022 10:25:35 -0400
|
|
Subject: [PATCH 2/6] libarchive: Handle `archive_entry_symlink()` returning
|
|
NULL
|
|
|
|
The `archive_entry_symlink()` API can definitely return `NULL`,
|
|
reading through the libarchive sources.
|
|
|
|
I hit this in the wild when using old ostree-ext to try to unpack
|
|
a chunked archive.
|
|
|
|
I didn't try to characterize this more, and sorry no unit test right
|
|
now.
|
|
---
|
|
src/libostree/ostree-repo-libarchive.c | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/libostree/ostree-repo-libarchive.c b/src/libostree/ostree-repo-libarchive.c
|
|
index 679aa44d..631c6d4b 100644
|
|
--- a/src/libostree/ostree-repo-libarchive.c
|
|
+++ b/src/libostree/ostree-repo-libarchive.c
|
|
@@ -146,8 +146,12 @@ file_info_from_archive_entry (struct archive_entry *entry)
|
|
|
|
g_autoptr(GFileInfo) info = _ostree_stbuf_to_gfileinfo (&stbuf);
|
|
if (S_ISLNK (stbuf.st_mode))
|
|
- g_file_info_set_attribute_byte_string (info, "standard::symlink-target",
|
|
- archive_entry_symlink (entry));
|
|
+ {
|
|
+ const char *target = archive_entry_symlink (entry);
|
|
+ if (target != NULL)
|
|
+ g_file_info_set_attribute_byte_string (info, "standard::symlink-target",
|
|
+ target);
|
|
+ }
|
|
|
|
return g_steal_pointer (&info);
|
|
}
|
|
--
|
|
2.31.1
|
|
|