This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Checked in/ARI: Use xsnprintf instead of sprintf (Re: New ARI warning Wed May 22 01:51:06 UTC 2013 in -D 2013-05-22-gmt)
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 23 May 2013 10:42:03 +0400
- Subject: Checked in/ARI: Use xsnprintf instead of sprintf (Re: New ARI warning Wed May 22 01:51:06 UTC 2013 in -D 2013-05-22-gmt)
- References: <20130522015106 dot GA6058 at sourceware dot org>
On Wed, May 22, 2013 at 01:51:06AM +0000, GDB Administrator wrote:
> 408a409
> > gdb/mi/mi-cmd-break.c:138: code: sprintf: Do not use sprintf, instead use xsnprintf or xstrprintf
> gdb/mi/mi-cmd-break.c:138: sprintf (tmp, ', (unsigned char) argv[0][i]);
> 568a570
> > gdb/python/python-internal.h:177: code: editCase function: Function name starts lower case but has uppercased letters.
> gdb/python/python-internal.h:177:gdb_Py_DECREF (void *op)
Since Pedro already fixed the second warning, and the first warning
was still left untouched, I decided to fix it. I think it's nicer
if we really strive to prevent new warnings from appearing...
gdb/ChangeLog:
* mi/mi-cmd-break.c (mi_argv_to_format): Use xsnprintf instead
of sprintf.
Tested on x86_64-linux, checked in.
--
Joel
>From f5548c8bbf818cea416f456342699de1cf97be2e Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Thu, 23 May 2013 10:12:13 +0400
Subject: [PATCH] mi/mi-cmd-break.c: Use xsnprintf instead of sprintf (ARI
fix)
gdb/ChangeLog:
* mi/mi-cmd-break.c (mi_argv_to_format): Use xsnprintf instead
of sprintf.
---
gdb/ChangeLog | 5 +++++
gdb/mi/mi-cmd-break.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9ca55d7..1c21cd4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-23 Joel Brobecker <brobecker@adacore.com>
+
+ * mi/mi-cmd-break.c (mi_argv_to_format): Use xsnprintf instead
+ of sprintf.
+
2013-05-22 Keith Seitz <keiths@redhat.com>
* ada-lang.c (is_known_support_routine): Add explicit free of
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 050cf3f..87ccee7 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -135,7 +135,8 @@ mi_argv_to_format (char **argv, int argc)
{
char tmp[5];
- sprintf (tmp, "\\%o", (unsigned char) argv[0][i]);
+ xsnprintf (tmp, sizeof (tmp), "\\%o",
+ (unsigned char) argv[0][i]);
obstack_grow (&obstack, tmp, strlen (tmp));
}
break;
--
1.7.10.4