]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* corelow.c (get_core_register_section): Replace usage of sprintf
authorMark Kettenis <kettenis@gnu.org>
Thu, 17 Mar 2005 22:07:42 +0000 (22:07 +0000)
committerMark Kettenis <kettenis@gnu.org>
Thu, 17 Mar 2005 22:07:42 +0000 (22:07 +0000)
and strcpy with xstrprintf and xstrdup.

gdb/ChangeLog
gdb/corelow.c

index 91ee65ed4808d040b439f54f083ead4edc996a10..3c62956c5feb9734e39a0b3d981184213ba18b69 100644 (file)
@@ -1,5 +1,8 @@
 2005-03-17  Mark Kettenis  <kettenis@gnu.org>
 
+       * corelow.c (get_core_register_section): Replace usage of sprintf
+       and strcpy with xstrprintf and xstrdup.
+
        * mips-tdep.c (mips_single_step_through_delay): Put back check for
        breakpoint lost with the introduction of this function.
 
index ebc068fb88af07551412001ff3717388e6c6a706..a78f71a147eab4f844e8fba3b902c2dc0c814539 100644 (file)
@@ -447,15 +447,16 @@ get_core_register_section (char *name,
                           char *human_name,
                           int required)
 {
-  char section_name[100];
+  static char *section_name = NULL;
   struct bfd_section *section;
   bfd_size_type size;
   char *contents;
 
+  xfree (section_name);
   if (PIDGET (inferior_ptid))
-    sprintf (section_name, "%s/%d", name, PIDGET (inferior_ptid));
+    section_name = xstrprintf ("%s/%d", name, PIDGET (inferior_ptid));
   else
-    strcpy (section_name, name);
+    section_name = xstrdup (name);
 
   section = bfd_get_section_by_name (core_bfd, section_name);
   if (! section)