From 860ace7e297f4f79b1cd52c7bbee48a5a1ed78ce Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Wed, 16 Jun 2021 16:43:11 +0200 Subject: qmerge: Protect against NULL ptr hash will be NULL if file does not exist. Signed-off-by: Joakim Tjernlund Signed-off-by: Fabian Groffen --- qmerge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'qmerge.c') diff --git a/qmerge.c b/qmerge.c index 2e8730e1..7b42956d 100644 --- a/qmerge.c +++ b/qmerge.c @@ -1513,7 +1513,9 @@ pkg_unmerge(tree_pkg_ctx *pkg_ctx, set *keep, /* If the file wasn't modified, unmerge it */ char *hash = hash_file_at(portroot_fd, e->name + 1, HASH_MD5); - protected = strcmp(e->digest, (const char *)hash); + protected = 0; + if (hash) + protected = strcmp(e->digest, (const char *)hash); } break; -- cgit v1.2.3-65-gdbad