Don't change calls to strcpy() to strncpy(); use strlcpy() instead.
authorDan Cross <crossd@gmail.com>
Thu, 15 Oct 2015 21:13:58 +0000 (17:13 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 28 Oct 2015 16:24:04 +0000 (12:24 -0400)
commitcbcf9a3d7f6c6f36e0a7aff66459a38d1c9ee923
tree280a17894c2cb0c039fea4f99d6e37ec7255e880
parent80c0f85995de9bdfabc67dd49f0763a67bc76fd0
Don't change calls to strcpy() to strncpy(); use strlcpy() instead.

The semantics of strncpy() are confusing. We had been
converting Plan 9 code to Akaros by replacing calls to
strcpy() (which we wisely removed from our kernel some
time ago), but strncpy():

1. Does not necessarily NUL-terminate it's destination
   buffer (e.g., if strlen(src) >= size),
2. Will nul-pad the entire destination string if the
   source string is shorter than the buffer length; this
   is wasteful if we just want proper NUL-termination.

Instead, call strlcpy(), which handles both of the above
cases correctly.

In general, one should not call strncpy() unless one is
sure that they want these semantics.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
scripts/plan9