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)
committerKees Cook <keescook@chromium.org>
Sun, 6 Feb 2022 18:55:03 +0000 (10:55 -0800)
commit27e9faf415dbf94af19b9c827842435edbc1fbbc
tree918848ab170d5af3f4efb9b2def57b8e1a7d545e
parentf154066b61dfde618d98fdafc8cadde076c7f222
gcc-plugins/stackleak: Exactly match strings instead of prefixes

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