cgit

commit 7cde5885d8ce53359ee665bb930b1da956e8369a

Author: Christian Hesse <mail@eworm.de>

parsing: ban strncpy()

Git upstream bans strncpy() with commit:

  banned.h: mark strncpy() as banned
  e488b7aba743d23b830d239dcc33d9ca0745a9ad

Signed-off-by: Christian Hesse <mail@eworm.de>

 parsing.c | 3 +--


diff --git a/parsing.c b/parsing.c
index 12453c2db289e1c7812de2cbcdbe128275930f92..e224564dc5346e74300ca35b567a6799f701ca57 100644
--- a/parsing.c
+++ b/parsing.c
@@ -63,8 +63,7 @@
 	if (tail < head)
 		return xstrdup("");
 	buf = xmalloc(tail - head + 1);
-	strncpy(buf, head, tail - head);
-	buf[tail - head] = '\0';
+	strlcpy(buf, head, tail - head + 1);
 	return buf;
 }