]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: archive: Only load support for what we use
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 18 Jan 2021 20:55:32 +0000 (20:55 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 18 Jan 2021 20:55:32 +0000 (20:55 +0000)
This reduces the footprint of libpakfire in memory as well as not
opening us up to any vulnerabilities in filters and formats of
libarchive that we do not use.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
configure.ac
src/libpakfire/archive.c

index 32cc047fcda7c481521206d42206df4c329b3070..f3816947ee1de7ae130b11bcbae7ac5c659e6480 100644 (file)
@@ -172,7 +172,7 @@ SOLV_LIBS="$LIBS"
 AC_SUBST(SOLV_LIBS)
 LIBS="$save_LIBS"
 
-PKG_CHECK_MODULES([ARCHIVE], [libarchive])
+PKG_CHECK_MODULES([ARCHIVE], [libarchive >= 3.3.3])
 PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}])
 PKG_CHECK_MODULES([LZMA], [liblzma])
 
index beb4cbe465e3374914aa0e8a41d1eb8bedbe25f0..154d488ff13b4cc18e609108e435a2ab04a1789a 100644 (file)
@@ -89,8 +89,12 @@ struct payload_archive_data {
 };
 
 static void configure_archive(struct archive* a) {
-       archive_read_support_filter_all(a);
-       archive_read_support_format_all(a);
+       // All of our packages are tar balls
+       archive_read_support_format_tar(a);
+
+       // They are compressed using XZ or ZSTD
+       archive_read_support_filter_xz(a);
+       archive_read_support_filter_zstd(a);
 }
 
 static int archive_open(PakfireArchive archive, struct archive** a) {