[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140924141449.GA13319@csclub.uwaterloo.ca>
Date: Wed, 24 Sep 2014 10:14:49 -0400
From: "Lennart Sorensen" <lsorense@...lub.uwaterloo.ca>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Andi Kleen <ak@...ux.intel.com>,
Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
Grant Likely <grant.likely@...aro.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib: string.c: Added a funktion function strzcpy
On Wed, Sep 24, 2014 at 10:52:06AM +0300, Dan Carpenter wrote:
> On Tue, Sep 23, 2014 at 06:17:53PM -0700, Andi Kleen wrote:
> > Do we really need the bizarre strncpy padding semantics for anything?
> > Why not just use strlcpy?
>
> We do need the padding in many places to prevent information leaks.
>
> So we end up open coding the last NUL after so many of the strncpy()
> calls. And we're adding more NUL terminators all over the place now
> just to make the code easier to audit.
I think the suggestion to use strlcpy makes sense too. strlcpy seems
to do exactly what is needed and has a known behaviour already.
--
Len Sorensen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists