[ovs-git] Open vSwitch: util: New function ovs_strzcpy(). (master)

dev at openvswitch.org dev at openvswitch.org
Wed Feb 23 00:37:13 UTC 2011

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  71d7c22f54ae32d15133571e09ddf7ab435e8afa (commit)
       via  e868fb3d322f5c46385f1fc6db5bb1ab33f90305 (commit)
       via  0e191d8fae33819ce953b0d02e0b2df0cd9b400f (commit)
      from  aa31e6051dd9fb471562f4a2180acf9692c73a10 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 71d7c22f54ae32d15133571e09ddf7ab435e8afa
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=71d7c22f54ae32d15133571e09ddf7ab435e8afa
Author: Ben Pfaff <blp at nicira.com>
util: New function ovs_strzcpy().
Static analyzers hate strncpy().  This new function shares its property of
initializing an entire buffer, without its nasty habit of failing to
null-terminate long strings.

Coverity #10697,10696,10695,10694,10693,10692,10691,10690.

commit e868fb3d322f5c46385f1fc6db5bb1ab33f90305
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=e868fb3d322f5c46385f1fc6db5bb1ab33f90305
Author: Ben Pfaff <blp at nicira.com>
util: Don't read over 'size - 1' bytes of source string in ovs_strlcpy().
The blind replacement of strncpy() by ovs_strlcpy() is risky because
strncpy() never reads more bytes from its source string than necessary to
write its destination string, but ovs_strlcpy() and the OpenBSD function
that inspired it both read the entire source string.  This avoids that

Given that change, we can use ovs_strlcpy() in a few more places, and
this commit does that too.

Coverity #10697,10696,10695,10694,10693,10692,10691,10690.

commit 0e191d8fae33819ce953b0d02e0b2df0cd9b400f
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=0e191d8fae33819ce953b0d02e0b2df0cd9b400f
Author: Ben Pfaff <blp at nicira.com>
string: Implement strnlen() if it is missing.


Summary of changes:
 configure.ac                 |    2 +-
 lib/automake.mk              |    1 +
 lib/netdev-linux.c           |   16 ++++++++--------
 lib/ofp-print.c              |    3 +--
 lib/route-table.c            |    5 ++---
 lib/socket-util.c            |    3 +--
 lib/{valgrind.h => string.c} |   20 +++++++++++---------
 lib/string.h                 |    8 +++++++-
 lib/util.c                   |   33 ++++++++++++++++++++++++++++-----
 lib/util.h                   |    3 ++-
 10 files changed, 62 insertions(+), 32 deletions(-)
 copy lib/{valgrind.h => string.c} (70%)

Open vSwitch

More information about the git mailing list