lkml.org 
[lkml]   [2017]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] replace incorrect strscpy use in FORTIFY_SOURCE
On Fri, Jul 14, 2017 at 2:28 PM, Daniel Micay <danielmicay@gmail.com> wrote:
> 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.
>
> Signed-off-by: Daniel Micay <danielmicay@gmail.com>

Thanks for fixing this! Linus, do you want to take this directly or
have it go via -mm where fortify landed originally?

Acked-by: Kees Cook <keescook@chromium.org>

As far as testing goes, was the NFS tree not in -next, or was a test
not running against -next? I'm curious why it took until the NFS tree
landed in Linus's tree for this to get noticed. Fortify was in -next
for a while...

-Kees

--
Kees Cook
Pixel Security

\
 
 \ /
  Last update: 2017-07-15 01:52    [W:3.251 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site