]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
gcc-plugins/stackleak: Exactly match strings instead of prefixes
authorKees Cook <keescook@chromium.org>
Sun, 6 Feb 2022 17:08:20 +0000 (09:08 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:39:41 +0000 (14:39 +0200)
commit18573f8aada35f3376110c8a05b10080d8cf513e
treedf96ccfff9d6689c700ec7b20ad13e1782e746d9
parent9fccf5bdba8093b5e1702bc4aa796cb611b4c65d
gcc-plugins/stackleak: Exactly match strings instead of prefixes

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 27e9faf415dbf94af19b9c827842435edbc1fbbc ]

Since STRING_CST may not be NUL terminated, strncmp() was used for check
for equality. However, this may lead to mismatches for longer section
names where the start matches the tested-for string. Test for exact
equality by checking for the presences of NUL termination.

Cc: Alexander Popov <alex.popov@linux.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 999ee266531bb38497a1ddef03f482961f3ae0e4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
scripts/gcc-plugins/stackleak_plugin.c