about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2019-02-12 21:53:02 +0100
committerChristian Hesse <mail@eworm.de>2019-06-05 15:37:49 +0200
commit68de710c1c0e9b823a156b1398643601a682fbf9 (patch)
tree27901bb130957f90467ac44642f31d46a4afd316
parentglobal: make 'char *path' const where possible (diff)
downloadcgit-pink-68de710c1c0e9b823a156b1398643601a682fbf9.tar.gz
cgit-pink-68de710c1c0e9b823a156b1398643601a682fbf9.zip
ui-ssdiff: ban strncat()
Git version v2.21.0 marks strncat() as banned (commit
ace5707a803eda0f1dde3d776dc3729d3bc7759a), so replace it.

Signed-off-by: Christian Hesse <mail@eworm.de>
-rw-r--r--ui-ssdiff.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index b6dc5b0..af8bc9e 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -117,7 +117,7 @@ static char *replace_tabs(char *line)
 	int n_tabs = 0;
 	int i;
 	char *result;
-	int result_len;
+	size_t result_len;
 
 	if (linelen == 0) {
 		result = xmalloc(1);
@@ -136,10 +136,12 @@ static char *replace_tabs(char *line)
 	for (;;) {
 		cur_buf = strchr(prev_buf, '\t');
 		if (!cur_buf) {
-			strncat(result, prev_buf, result_len);
+			linelen = strlen(result);
+			strlcpy(&result[linelen], prev_buf, result_len - linelen + 1);
 			break;
 		} else {
-			strncat(result, prev_buf, cur_buf - prev_buf);
+			linelen = strlen(result);
+			strlcpy(&result[linelen], prev_buf, cur_buf - prev_buf + 1);
 			linelen = strlen(result);
 			memset(&result[linelen], ' ', 8 - (linelen % 8));
 			result[linelen + 8 - (linelen % 8)] = '\0';
/www/photo.causal.agency/2024-10-05/lens?id=8896a95764f011c24d0817c07e23bfa4887f7da1&follow=1'>Add photos from October 5June McEnroe 2024-10-09Add photos from October 1June McEnroe 2024-10-07Add photos from September 29June McEnroe 2024-10-07Add photos from September 28June McEnroe 2024-10-07Add photos from September 22June McEnroe 2024-09-25Add photos from September 15June McEnroe 2024-09-24Add photos from September 14June McEnroe 2024-09-24Add photos from September 12June McEnroe 2024-09-24Add photos from September 7June McEnroe 2024-09-24Allow not having descriptionsJune McEnroe 2024-09-23Automatically select the last used lens for a bodyJune McEnroe 2024-09-19Add photos from September 5June McEnroe 2024-09-15Add some more film stocks to the listJune McEnroe 2024-09-13Add photos from September 2June McEnroe 2024-09-13Add Fomapan 200 to films listJune McEnroe 2024-09-10Add August 29 picnic photosJune McEnroe 2024-09-08Apply some bold to trips renderingJune McEnroe 2024-09-08Render trips hopefully more efficientlyJune McEnroe 2024-09-08Allow removing bodies and lensesJune McEnroe 2024-09-08Limit body width so it looks less silly on desktopJune McEnroe 2024-09-07Handle no film being loadedJune McEnroe 2024-09-07Fancy up the text a littleJune McEnroe