From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason at zx2c4.com (Jason A. Donenfeld) Date: Sat, 9 Feb 2019 12:31:57 +0100 Subject: [PATCH 1/2] ui-ssdiff: ban strncat() In-Reply-To: <20190208214812.26937-1-list@eworm.de> References: <20190207105358.GA8156@john.keeping.me.uk> <20190208214812.26937-1-list@eworm.de> Message-ID: You sure those statements are the same? Snprintf doesn't append like strncat. Wouldn't strlcat be the more apt replacement? -- Sent from my telephone. On Fri, Feb 8, 2019, 22:49 Christian Hesse From: Christian Hesse > > Git version v2.21.0 marks strncat() as banned (commit > ace5707a803eda0f1dde3d776dc3729d3bc7759a), so replace it. > > Signed-off-by: Christian Hesse > Reviewed-by: John Keeping > --- > ui-ssdiff.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/ui-ssdiff.c b/ui-ssdiff.c > index c456033..1f12cfc 100644 > --- a/ui-ssdiff.c > +++ b/ui-ssdiff.c > @@ -136,10 +136,10 @@ static char *replace_tabs(char *line) > for (;;) { > cur_buf = strchr(prev_buf, '\t'); > if (!cur_buf) { > - strncat(result, prev_buf, result_len); > + snprintf(result, result_len, "%s", prev_buf); > break; > } else { > - strncat(result, prev_buf, cur_buf - prev_buf); > + snprintf(result, cur_buf - prev_buf, "%s", > prev_buf); > linelen = strlen(result); > memset(&result[linelen], ' ', 8 - (linelen % 8)); > result[linelen + 8 - (linelen % 8)] = '\0'; > _______________________________________________ > CGit mailing list > CGit at lists.zx2c4.com > https://lists.zx2c4.com/mailman/listinfo/cgit > -------------- next part -------------- An HTML attachment was scrubbed... URL: