This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Re: New ARI warning Sat May 28 01:53:47 UTC 2011
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>, Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 30 May 2011 21:28:42 +0200
- Subject: [commit] Re: New ARI warning Sat May 28 01:53:47 UTC 2011
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)
{