give strncpy() an appropriate limit

This tells strncpy() to copy max_len bytes instead of strlen(src)
bytes, which will set bytes beyond strlen(src) with null bytes.

We really only need strlen(src) + 1, but for debugging it's
nice not to have a bunch of garbage in the destination buffer.

This fixes a test which err'd due to the lack of a terminating NULL
at the end of dest (do_strcpy is only used by unit tests).

BUG=none
TEST=make test

Change-Id: I73e19a15c91d874702b84877100cbf8d51bf8ac1
Reviewed-on: https://gerrit.chromium.org/gerrit/45143
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
1 file changed