On Tue, Feb 05, 2013 at 09:35:31AM +0100, Mathias Krause wrote:
> On Mon, Feb 4, 2013 at 2:15 PM, Herbert Xu <herb...@gondor.apana.org.au> 
> wrote:
> > On Sun, Feb 03, 2013 at 12:09:01PM +0100, Mathias Krause wrote:
> >> The current test for empty strings fails because it is testing the
> >> address of a field, not a pointer. So the test will always be true.
> >> Test for the string length instead.
> >>
> >> Signed-off-by: Mathias Krause <mini...@googlemail.com>
> >> Cc: Steffen Klassert <steffen.klass...@secunet.com>
> >
> > Good catch.  However, what if cru_driver_name isn't NUL-terminated?
> 
> Your objection is totally valid, sure. And my initial idea wouldn't
> have that problem as it would just test for the first character to be
> '\0', i.e. do something like that:
> 
> -       if (!p->cru_driver_name)
> +       if (!p->cru_driver_name[0])
> 
> But then I looked how the other code in the crypto user API does refer
> to string lengths related to cru_driver_name and switched to strlen().
> So the other code is (potentially) vulnerable to non-NUL-terminated
> strings, too.
> 
> So, I think we need another patch that adds sanity checks for
> non-NUL-terminated strings. I can do this, maybe this evening, and
> send out a new version of the patch series if you like me to.

Let's just fix the problem at hand first and you can follow it up
with another patch to cure the other strlens.

Thanks,
-- 
Email: Herbert Xu <herb...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to