aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-11-07 09:37:31 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2016-12-08 14:12:56 +0100
commitb72aa3b703ad31091a55c988af87985c8643e316 (patch)
treecd02030b68e32275606cfcd007310fe0ba029510
parent3ffca0b60191ca5b042f03cfc824b4905a287322 (diff)
downloadmeta-swupd-b72aa3b703ad31091a55c988af87985c8643e316.tar.gz
meta-swupd-b72aa3b703ad31091a55c988af87985c8643e316.tar.bz2
meta-swupd-b72aa3b703ad31091a55c988af87985c8643e316.zip
swupd-server: avoid segfault when nothing changed
swupd_create_fullfiles segfaulted when no new files were needed for the current build because nothing changed. Very unlikely, but can happen during testing. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
-rw-r--r--recipes-core/swupd-server/swupd-server/swupd_create_fullfiles-avoid-segfault-when-nothing-c.patch32
-rw-r--r--recipes-core/swupd-server/swupd-server_git.bb1
2 files changed, 33 insertions, 0 deletions
diff --git a/recipes-core/swupd-server/swupd-server/swupd_create_fullfiles-avoid-segfault-when-nothing-c.patch b/recipes-core/swupd-server/swupd-server/swupd_create_fullfiles-avoid-segfault-when-nothing-c.patch
new file mode 100644
index 0000000..4f5ba19
--- /dev/null
+++ b/recipes-core/swupd-server/swupd-server/swupd_create_fullfiles-avoid-segfault-when-nothing-c.patch
@@ -0,0 +1,32 @@
+From edd16ae9b9aa2315aa6d1b8ee73239a3baa2f998 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Mon, 7 Nov 2016 09:05:40 +0100
+Subject: [PATCH] swupd_create_fullfiles: avoid segfault when nothing changes
+
+In the (unlikely) case that nothing changed between two builds,
+get_deduplicated_fullfile_list() segfaults because it uses
+manifest->files without checking for NULL, aka the empty list.
+
+Upstream-Status: Submitted [https://github.com/clearlinux/swupd-server/pull/36]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ src/fullfiles.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/fullfiles.c b/src/fullfiles.c
+index 214b7b4..0d6ecf2 100644
+--- a/src/fullfiles.c
++++ b/src/fullfiles.c
+@@ -300,7 +300,7 @@ static GList *get_deduplicated_fullfile_list(struct manifest *manifest)
+ manifest->files = g_list_sort(manifest->files, file_sort_hash);
+
+ list = g_list_first(manifest->files);
+- while (prev == NULL) {
++ while (prev == NULL && list != NULL) {
+ tmp = list->data;
+ list = g_list_next(list);
+
+--
+2.1.4
+
diff --git a/recipes-core/swupd-server/swupd-server_git.bb b/recipes-core/swupd-server/swupd-server_git.bb
index 88e2d17..a433cac 100644
--- a/recipes-core/swupd-server/swupd-server_git.bb
+++ b/recipes-core/swupd-server/swupd-server_git.bb
@@ -15,6 +15,7 @@ SRC_URI = "git://github.com/clearlinux/swupd-server.git;protocol=https \
file://0029-fullfiles-use-libarchive-directly.patch \
file://0001-swupd-create-update-alternative-input-layout.patch \
file://0002-add-logging-to-stdout.patch \
+ file://swupd_create_fullfiles-avoid-segfault-when-nothing-c.patch \
"
SRCREV = "ddca171dad32229ceeff8b8527a179610b88ce55"