From mboxrd@z Thu Jan 1 00:00:00 1970 From: list at eworm.de (Christian Hesse) Date: Sat, 16 Jun 2018 23:52:10 +0200 Subject: [PATCH 2/2] gcc8.1: fix strcat warning In-Reply-To: <20180616131150.GP1922@john.keeping.me.uk> References: <152884643982.29435.12041657288903581464.stgit@mail.warmcat.com> <152884644738.29435.16487549202475422342.stgit@mail.warmcat.com> <20180616131150.GP1922@john.keeping.me.uk> Message-ID: <20180616235210.3b75d3bf@leda> John Keeping on Sat, 2018/06/16 14:11: > On Wed, Jun 13, 2018 at 07:34:07AM +0800, Andy Green wrote: > > ../ui-ssdiff.c: In function ?replace_tabs?: > > ../ui-ssdiff.c:142:4: warning: ?strncat? output truncated copying between > > 1 and 8 bytes from a string of length 8 [-Wstringop-truncation] > > strncat(result, spaces, 8 - (strlen(result) % 8)); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > Actually the strncat that was there before intends that its > > stock of spaces gets truncated, and it's not a problem. > > > > However gcc8.1 is also right, normally truncation is undesirable. > > > > Make the code do the padding explicitly. > > > > Signed-off-by: Andy Green > > Reviewed-by: John Keeping Agreed, except the typo in commit message. This is about strncat, not strcat. -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);} -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: