about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2018-08-28 18:23:36 +0200
committerChristian Hesse <mail@eworm.de>2018-09-11 08:47:12 +0200
commita96f2890f41e0b9b0ffa1bcdb1dddbef28c01662 (patch)
treed88340d58313c6f20e063003d809e158c7295c29
parentui-ssdiff: ban strncpy() (diff)
downloadcgit-pink-a96f2890f41e0b9b0ffa1bcdb1dddbef28c01662.tar.gz
cgit-pink-a96f2890f41e0b9b0ffa1bcdb1dddbef28c01662.zip
ui-ssdiff: ban strcat()
Git upstream bans strcat() with commit:

  banned.h: mark strcat() as banned
  1b11b64b815db62f93a04242e4aed5687a448748

Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to '')
-rw-r--r--ui-ssdiff.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index a3dd059..c456033 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -117,6 +117,7 @@ static char *replace_tabs(char *line)
 	int n_tabs = 0;
 	int i;
 	char *result;
+	int result_len;
 
 	if (linelen == 0) {
 		result = xmalloc(1);
@@ -128,13 +129,14 @@ static char *replace_tabs(char *line)
 		if (line[i] == '\t')
 			n_tabs += 1;
 	}
-	result = xmalloc(linelen + n_tabs * 8 + 1);
+	result_len = linelen + n_tabs * 8;
+	result = xmalloc(result_len + 1);
 	result[0] = '\0';
 
 	for (;;) {
 		cur_buf = strchr(prev_buf, '\t');
 		if (!cur_buf) {
-			strcat(result, prev_buf);
+			strncat(result, prev_buf, result_len);
 			break;
 		} else {
 			strncat(result, prev_buf, cur_buf - prev_buf);
r class='logheader'>2019-09-23Add Trail of LightningJune McEnroe 2019-09-22Revert "Enable cookies in title"June McEnroe This reverts commit 279111dda15dd9170e11b9688eb973f2af2e6300. 2019-09-20Enable cookies in titleJune McEnroe Perhaps this will make it less suspicious to Google. Who knows. 2019-09-16Use sensitivity aliases in TF2June McEnroe 2019-09-16Add The Just CityJune McEnroe 2019-09-12Only GET the final redirect locationJune McEnroe 2019-09-12Consume entire bodyJune McEnroe Aborting the request and leaving data around may be causing intermittent errors. Just discard the rest of the data. 2019-09-10Add title -v flagJune McEnroe 2019-09-10Use curl error bufferJune McEnroe 2019-09-10Set Accept-Encoding in titleJune McEnroe Because apparently it's fine for servers to respond with Content-Encoding you didn't ask for, and curl won't decode it if you didn't ask for it. 2019-09-08Set title User-AgentJune McEnroe Some things don't like you if you don't send one. 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe Allows restarting consumers safely. 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe Oops, didn't see this. 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe