Skip to content
Commit 4c5c1c70 authored by Vikram Mulukutla's avatar Vikram Mulukutla
Browse files

replace incorrect strscpy use in FORTIFY_SOURCE



Using strscpy was wrong because FORTIFY_SOURCE is passing the maximum
possible size of the outermost object, but strscpy defines the count
parameter as the exact buffer size, so this could copy past the end of
the source.  This would still be wrong with the planned usage of
__builtin_object_size(p, 1) for intra-object overflow checks since it's
the maximum possible size of the specified object with no guarantee of
it being that large.

Reuse of the fortified functions like this currently makes the runtime
error reporting less precise but that can be improved later on.

Noticed by Dave Jones and KASAN.

Change-Id: I0b485afdcab001002152d39ade3189db6dbaa1c8
Signed-off-by: default avatarDaniel Micay <danielmicay@gmail.com>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Reported-by: default avatarDave Jones <davej@codemonkey.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Git-commit: 077d2ba519b2e8bf1abd80cbade699b1de42cafe
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent d2ae07b1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment