Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release-src > by-pkgid > c5d5f5a6b7e251a1409fa6ef27e29e63 > files > 8

cgit-1.2.1-4.mga7.src.rpm

From 0899eb644fab415e9a3b304f53da9da50aaf91aa Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Tue, 28 Aug 2018 18:22:26 +0200
Subject: [PATCH 08/20] ui-ssdiff: ban strncpy()

Git upstream bans strncpy() with commit:

  banned.h: mark strncpy() as banned
  e488b7aba743d23b830d239dcc33d9ca0745a9ad

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 ui-ssdiff.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index 68c2044..a3dd059 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -103,8 +103,7 @@ static int line_from_hunk(char *line, char type)
 		return 0;
 	len = buf2 - buf1;
 	buf2 = xmalloc(len + 1);
-	strncpy(buf2, buf1, len);
-	buf2[len] = '\0';
+	strlcpy(buf2, buf1, len + 1);
 	res = atoi(buf2);
 	free(buf2);
 	return res;
-- 
2.21.0