]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
samples/landlock: Fix possible NULL dereference in parse_path()
authorZichen Xie <zichenxie0106@gmail.com>
Thu, 28 Nov 2024 03:29:56 +0000 (21:29 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:49:57 +0000 (12:49 +0100)
commita7e98a85990af7292d472875ee917cf491fdd7d7
tree8e997e569d183efa54ea2fa42bca63b50931c0fd
parent332ee5fc52e1b9654788bf409f4f8d709601a867
samples/landlock: Fix possible NULL dereference in parse_path()

[ Upstream commit 078bf9438a31567e2c0587159ccefde835fb1ced ]

malloc() may return NULL, leading to NULL dereference.  Add a NULL
check.

Fixes: ba84b0bf5a16 ("samples/landlock: Add a sandbox manager example")
Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
Link: https://lore.kernel.org/r/20241128032955.11711-1-zichenxie0106@gmail.com
[mic: Simplify fix]
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
samples/landlock/sandboxer.c