about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorChristian Hesse2018-08-28 18:22:26 +0200
committerChristian Hesse2018-09-11 08:47:12 +0200
commit0899eb644fab415e9a3b304f53da9da50aaf91aa (patch)
tree3660c115fff77d75e07d92b39bb54c1440ee5b42
parentui-shared: ban strcat() (diff)
downloadcgit-0899eb644fab415e9a3b304f53da9da50aaf91aa.tar.gz
cgit-0899eb644fab415e9a3b304f53da9da50aaf91aa.zip
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>
-rw-r--r--ui-ssdiff.c3
1 files changed, 1 insertions, 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)
103 return 0; 103 return 0;
104 len = buf2 - buf1; 104 len = buf2 - buf1;
105 buf2 = xmalloc(len + 1); 105 buf2 = xmalloc(len + 1);
106 strncpy(buf2, buf1, len); 106 strlcpy(buf2, buf1, len + 1);
107 buf2[len] = '\0';
108 res = atoi(buf2); 107 res = atoi(buf2);
109 free(buf2); 108 free(buf2);
110 return res; 109 return res;