diff options
author | Colin Walters <walters@verbum.org> | 2022-04-04 10:25:35 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2022-04-04 10:25:35 -0400 |
commit | 2346d5f4d581ca11617e0f215a40cf146754cb22 (patch) | |
tree | 87af9097cda1af190d2844cb22326011ffbccae8 /src/libostree/ostree-repo-libarchive.c | |
parent | fdfb353f19e8e7f3f62cf26e1a6840ca9649012d (diff) | |
download | ostree-2346d5f4d581ca11617e0f215a40cf146754cb22.tar.gz |
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.
Diffstat (limited to 'src/libostree/ostree-repo-libarchive.c')
-rw-r--r-- | src/libostree/ostree-repo-libarchive.c | 8 |
1 files 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); } |