[ovs-dev] [strings 0/3] Improve string-handling safety

Ben Pfaff blp at nicira.com
Tue Feb 22 19:01:40 UTC 2011


This series of patches improves the safety of string handling in
Open vSwitch.  I don't think that it actually fixes any real bugs,
but it removes all references to strncpy() from the source code,
which makes people and static checkers happier.

Ben Pfaff (3):
  string: Implement strnlen() if it is missing.
  util: Don't read over 'size - 1' bytes of source string in
    ovs_strlcpy().
  util: New function ovs_strzcpy().

 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/{string.h => string.c} |   26 ++++++++++----------------
 lib/string.h               |    8 +++++++-
 lib/util.c                 |   33 ++++++++++++++++++++++++++++-----
 lib/util.h                 |    3 ++-
 10 files changed, 61 insertions(+), 39 deletions(-)
 copy lib/{string.h => string.c} (50%)





More information about the dev mailing list