Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch 1/3] Code cleanup: strcpy + strlen -> sprintf
@ 2011-10-18 20:52 Jan Kratochvil
  2011-10-19  0:24 ` Mark Kettenis
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2011-10-18 20:52 UTC (permalink / raw)
  To: gdb-patches; +Cc: Paul Pluzhnikov

Hi,

I do not understand much the reasons, maybe a fear about violating C sequence
points.  I hope it is not due to incompatible sprintf on MS-Windows CE or some
such gdbserver platform.

I would check it in with the other patches depending on this.


Thanks,
Jan


gdb/gdbserver/
2011-10-18  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* server.c (handle_qxfer_libraries): Replace strcpy and strlen pairs by
	sprintf.

--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -960,18 +960,11 @@ handle_qxfer_libraries (const char *annex,
       struct dll_info *dll = (struct dll_info *) dll_ptr;
       char *name;
 
-      strcpy (p, "  <library name=\"");
-      p = p + strlen (p);
       name = xml_escape_text (dll->name);
-      strcpy (p, name);
+      p += sprintf (p, "  <library name=\"%s\"><segment address=\"0x%lx\"/>"
+		       "</library>\n",
+		    name, (long) dll->base_addr);
       free (name);
-      p = p + strlen (p);
-      strcpy (p, "\"><segment address=\"");
-      p = p + strlen (p);
-      sprintf (p, "0x%lx", (long) dll->base_addr);
-      p = p + strlen (p);
-      strcpy (p, "\"/></library>\n");
-      p = p + strlen (p);
     }
 
   strcpy (p, "</library-list>\n");


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-19 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-18 20:52 [patch 1/3] Code cleanup: strcpy + strlen -> sprintf Jan Kratochvil
2011-10-19  0:24 ` Mark Kettenis
2011-10-19  8:40   ` Jan Kratochvil
2011-10-19 14:08     ` Tom Tromey
2011-10-19 14:40       ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox