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>
diff --git a/lib/input_kv_pair.c b/lib/input_kv_pair.c
index 1e1f9ce..d1f4d54 100644
--- a/lib/input_kv_pair.c
+++ b/lib/input_kv_pair.c
@@ -85,7 +85,7 @@
 	if (!dest || !src || (strlen(src) > max_len))
 		return -1;
 
-	strncpy(dest, src, strlen(src));
+	strncpy(dest, src, max_len);
 	return 0;
 }