Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>,
	       Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: [commit] Re: New ARI warning Sat May 28 01:53:47 UTC 2011
Date: Mon, 30 May 2011 19:29:00 -0000	[thread overview]
Message-ID: <20110530192841.GA11867@host1.jankratochvil.net> (raw)
In-Reply-To: <201105301916.p4UJG4N2001438@glazunov.sibelius.xs4all.nl> <20110530185933.GD2620@adacore.com>

On Mon, 30 May 2011 20:59:33 +0200, Joel Brobecker wrote:
> That lead me to consider the removal of this rule.  But in the end,
> I think it's useful to be reminded every time we use sprintf that
> there is xtrsprintf. Since this hasn't produced too many false
> positives, I think it's OK to keep it for now.

GCC already warns in appropriate cases for sprintf but I find the ARI rule
sure useful in general.


> If you put /* ARI: sprintf */ on the sprintf line, that should take
> care of the warning...

I did not know, thanks.


On Mon, 30 May 2011 21:16:04 +0200, Mark Kettenis wrote:
> Sorry, no.  Please replace this with a call to xsnprintf.

Done, when there are any concerns.

Checked in.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2011-05/msg00245.html

--- src/gdb/ChangeLog	2011/05/30 18:04:31	1.13065
+++ src/gdb/ChangeLog	2011/05/30 19:26:36	1.13066
@@ -1,3 +1,7 @@
+2011-05-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* linux-nat.c (linux_lwp_is_zombie): Use xsnprintf.
+
 2011-05-30  Pedro Alves  <pedro@codesourcery.com>
 
 	* continuations.h (continuation_ftype): Add `err' parameter.
--- src/gdb/linux-nat.c	2011/05/27 16:55:38	1.206
+++ src/gdb/linux-nat.c	2011/05/30 19:26:36	1.207
@@ -2365,7 +2365,7 @@
   FILE *procfile;
   int retval = 0;
 
-  sprintf (buffer, "/proc/%ld/status", lwp);
+  xsnprintf (buffer, sizeof (buffer), "/proc/%ld/status", lwp);
   procfile = fopen (buffer, "r");
   if (procfile == NULL)
     {


  reply	other threads:[~2011-05-30 19:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28  1:54 GDB Administrator
2011-05-30 18:35 ` Jan Kratochvil
2011-05-30 18:59   ` Joel Brobecker
2011-05-30 19:29     ` Jan Kratochvil [this message]
2011-05-30 19:38       ` [commit] " Mark Kettenis
2011-05-30 19:50       ` Joel Brobecker
2011-05-30 19:59         ` [ARI/commit] enhance suggestion in "sprintf" rule (was: "Re: [commit] Re: New ARI warning Sat May 28 01:53:47 UTC 2011") Joel Brobecker
2011-05-31  7:58           ` Pierre Muller
2011-05-30 19:16   ` New ARI warning Sat May 28 01:53:47 UTC 2011 Mark Kettenis

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=20110530192841.GA11867@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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