[ovs-dev] [coverity 10/14] netdev-linux: Use ovs_strlcpy() instead of improper strncpy().

Ben Pfaff blp at nicira.com
Tue Feb 22 17:55:07 UTC 2011


On Tue, Feb 22, 2011 at 09:48:01AM -0800, Justin Pettit wrote:
> On Feb 22, 2011, at 9:43 AM, Ben Pfaff wrote:
> 
> > On Mon, Feb 21, 2011 at 05:44:53PM -0800, Justin Pettit wrote:
> >> Coverity #10697,10696,10695,10694,10693,10692,10691,10690
> > 
> > I'd prefer to use strncpy() here instead of ovs_strlcpy() because the
> > former initializes every byte in the buffer.  If we don't do that then
> > I imagine we will get some complaints from valgrind.
> > 
> > The kernel has to handle this right or it's a horrible security bug
> > anyway.
> 
> Do you want to use strncpy() as it's currently being used or a
> corrected version that nul-terminates a long string?  It seems like
> its still worth cleaning up with some method so that these static
> analyzers don't trip on it.

If you want we can invent an ovs_strzcpy() or whatever that does that.
I'd have no objection to that.




More information about the dev mailing list