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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:54 +0000 (14:23 +0200)
commit999ee266531bb38497a1ddef03f482961f3ae0e4
tree611e4142a37fc63f42a5c49b39a2738610f5fa44
parentca97dfbda5105f9b6220ff286c07367633ff2b55
gcc-plugins/stackleak: Exactly match strings instead of prefixes

[ 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>
scripts/gcc-plugins/stackleak_plugin.c