[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ina7ehni.fsf@rasmusvillemoes.dk>
Date: Wed, 07 Mar 2018 21:48:33 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Kees Cook <keescook@...omium.org>
Cc: Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
LKML <linux-kernel@...r.kernel.org>,
"Tobin C. Harding" <me@...in.cc>, Tycho Andersen <tycho@...ho.ws>,
Oleg Drokin <oleg.drokin@...el.com>,
Andreas Dilger <andreas.dilger@...el.com>,
James Simmons <jsimmons@...radead.org>,
Dmitry Eremin <dmitry.eremin@...el.com>,
Gargi Sharma <gs051095@...il.com>,
Lustre Development List <lustre-devel@...ts.lustre.org>,
devel@...verdev.osuosl.org,
Kernel Hardening <kernel-hardening@...ts.openwall.com>
Subject: Re: [PATCH] staging: lustre: Remove VLA usage
On Wed, Mar 07 2018, Kees Cook <keescook@...omium.org> wrote:
> On Wed, Mar 7, 2018 at 5:10 AM, Rasmus Villemoes
> <rasmus.villemoes@...vas.dk> wrote:
>> On 2018-03-07 06:46, Kees Cook wrote:
>>> The kernel would like to remove all VLA usage. This switches to a
>>> simple kasprintf() instead.
>>>
>>
>> It's probably worth pointing out that this actually fixes an
>> unconditional buffer overflow: fullname only has room for the two
>> strings and the '\n', but vsnprintf() is told that the buffer has
>> infinite size (well, INT_MAX), so there should be plenty of room to
>> append the '\0' after the '\n'.
>>
>
> Oh yes, hah. I didn't even see the \n in the string. :P
>
> So, both a VLA fix and a buffer over-run fix. Can I add your "Reviewed-by"? :)
Sure,
Reviewed-by: Rasmus Villemoes <linux@...musvillemoes.dk>
A nit, if you're resending anyway: can you move the "char *fullname"
declarations down a bit, to between pv,valid, and lli,rc, respectively?
That keeps the initialized and uninitialized variables nicely together
and ends up looking better.
Powered by blists - more mailing lists