fortify: Fix dropped strcpy() compile-time write overflow check
authorKees Cook <keescook@chromium.org>
Mon, 2 Aug 2021 17:25:01 +0000 (10:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:25 +0000 (19:16 +0100)
commit80adbd8c450235c6618311103ab578190a80bfd0
tree86548a675fbb221b88d4bfe9d00e22c786990b8e
parentc9f95c678318e47be6c0981c305b39d0276e687c
fortify: Fix dropped strcpy() compile-time write overflow check

[ Upstream commit 072af0c638dc8a5c7db2edc4dddbd6d44bee3bdb ]

The implementation for intra-object overflow in str*-family functions
accidentally dropped compile-time write overflow checking in strcpy(),
leaving it entirely to run-time. Add back the intended check.

Fixes: 6a39e62abbaf ("lib: string.h: detect intra-object overflow in fortified string functions")
Cc: Daniel Axtens <dja@axtens.net>
Cc: Francis Laniel <laniel_francis@privacyrequired.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/fortify-string.h