List for cgit developers and users
 help / color / mirror / Atom feed
From: list at eworm.de (Christian Hesse)
Subject: [PATCH 2/2] gcc8.1: fix strcat warning
Date: Sat, 16 Jun 2018 23:52:10 +0200	[thread overview]
Message-ID: <20180616235210.3b75d3bf@leda> (raw)
In-Reply-To: <20180616131150.GP1922@john.keeping.me.uk>

John Keeping <john at keeping.me.uk> 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 <andy at warmcat.com>  
> 
> Reviewed-by: John Keeping <john at keeping.me.uk>

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: <http://lists.zx2c4.com/pipermail/cgit/attachments/20180616/ba8141ee/attachment.asc>


  reply	other threads:[~2018-06-16 21:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 23:33 [PATCH 1/2] gcc8.1: fix strncpy bounds warnings andy
2018-06-12 23:34 ` [PATCH 2/2] gcc8.1: fix strcat warning andy
2018-06-16 13:11   ` john
2018-06-16 21:52     ` list [this message]
2018-06-17  2:28       ` andy
2018-06-16 13:04 ` [PATCH 1/2] gcc8.1: fix strncpy bounds warnings john
2018-06-16 13:07   ` [PATCH 1/2] shared: allocate return value from expand_macros() john
2018-06-16 13:07     ` [PATCH 2/2] shared: use strbuf for expanding macros john
2018-06-16 13:12   ` [PATCH 1/2] gcc8.1: fix strncpy bounds warnings andy
2018-06-16 14:14     ` john
2018-06-26 11:36   ` [PATCH v2 0/2] " andy
2018-06-26 11:36     ` [PATCH v2 1/2] " andy
2018-06-26 11:36     ` [PATCH v2 2/2] cgit_repobasename: convert to allocated result andy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180616235210.3b75d3bf@leda \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).