Blame SOURCES/0002-libarchive-Handle-archive_entry_symlink-returning-NU.patch

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