blob: 4f5ba193b1ec7c5f185972b7c578a2bcf6b0c7c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|