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

Justin Pettit jpettit at nicira.com
Tue Feb 22 17:48:01 UTC 2011


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.

--Justin






More information about the dev mailing list