From cd33eaa2513a143c47775777806ebb2e759c7617 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 24 Sep 2018 15:22:25 +0200 Subject: [PATCH] security: Don't try to lock NULL paths It may happen that in the list of paths/disk sources to relabel there is a disk source. If that is the case, the path is NULL. In that case, we shouldn't try to lock the path. It's likely a network disk anyway and therefore there is nothing to lock. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- src/security/security_dac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 5aea386e7c..62442745dd 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -216,7 +216,8 @@ virSecurityDACTransactionRun(pid_t pid ATTRIBUTE_UNUSED, for (i = 0; i < list->nItems; i++) { const char *p = list->items[i]->path; - if (virFileIsDir(p)) + if (!p || + virFileIsDir(p)) continue; VIR_APPEND_ELEMENT_COPY_INPLACE(paths, npaths, p);