From 971f2eb45aca96ae62d647f3bbb58c100fb6b2f2 Mon Sep 17 00:00:00 2001 From: Ben Cooksley <bcooksley@kde.org> Date: Sun, 14 Jan 2024 20:28:20 +1300 Subject: [PATCH] [NO NEW TESTS NEEDED] [FreeBSD] Fix crash when running podman inspect When preparing container inspection output, ensure we actually have masked paths to work with. These will only be available on Linux, which is no longer always true as we also support FreeBSD now. Fixes #21117 Signed-off-by: Ben Cooksley <bcooksley@kde.org> --- libpod/container_inspect.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go index 64419329cd..b3aa2510f4 100644 --- a/libpod/container_inspect.go +++ b/libpod/container_inspect.go @@ -315,7 +315,7 @@ func (c *Container) GetSecurityOptions() []string { if apparmor, ok := ctrSpec.Annotations[define.InspectAnnotationApparmor]; ok { SecurityOpt = append(SecurityOpt, fmt.Sprintf("apparmor=%s", apparmor)) } - if c.config.Spec.Linux.MaskedPaths == nil { + if c.config.Spec != nil && c.config.Spec.Linux != nil && c.config.Spec.Linux.MaskedPaths == nil { SecurityOpt = append(SecurityOpt, "unmask=all") }