From 7cde5885d8ce53359ee665bb930b1da956e8369a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 28 Aug 2018 18:11:50 +0200 Subject: parsing: ban strncpy() Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse --- parsing.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parsing.c b/parsing.c index 12453c2..e224564 100644 --- a/parsing.c +++ b/parsing.c @@ -63,8 +63,7 @@ static char *substr(const char *head, const char *tail) 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; } -- cgit