]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* inf-ttrace.c (inf_ttrace_pid_to_str): Use snprintf instead of
authorMark Kettenis <kettenis@gnu.org>
Sun, 13 Mar 2005 22:06:10 +0000 (22:06 +0000)
committerMark Kettenis <kettenis@gnu.org>
Sun, 13 Mar 2005 22:06:10 +0000 (22:06 +0000)
sprintf.
* target.c (normal_pid_to_str): Likewise.
* remote.c (remote_pid_to_str): Use snprint instead of sprintf.
Change capitalization of "thread".  Use ptid_get_pid instead of
GETPID.

gdb/ChangeLog
gdb/inf-ttrace.c
gdb/remote.c
gdb/target.c

index eef69955610025e72f6bcd1d885ac5347d5a7498..a7a9353f1f92e3d4cc4a94bbce8c7bd92adf97cd 100644 (file)
@@ -1,4 +1,11 @@
-2005-03-13  Mark Kettenis  <kettenis@gnu.org>
+2005-03-13  Mark Kettenis  <kettenis@elgar.gnu.org>
+
+       * inf-ttrace.c (inf_ttrace_pid_to_str): Use snprintf instead of
+       sprintf.
+       * target.c (normal_pid_to_str): Likewise.
+       * remote.c (remote_pid_to_str): Use snprint instead of sprintf.
+       Change capitalization of "thread".  Use ptid_get_pid instead of
+       GETPID.
 
        * cp-abi.c (set_cp_abi_as_auto_default): Use xasprintf instead of
        a combination of xmalloc and sprintf.
index 253323824b9d24afcf765cf14931d9af3ab8015b..7e3e79ac75db8c5c18b9526b89c3d4830ff8073e 100644 (file)
@@ -908,9 +908,12 @@ inf_ttrace_pid_to_str (ptid_t ptid)
     {
       pid_t pid = ptid_get_pid (ptid);
       lwpid_t lwpid = ptid_get_lwp (ptid);
-      static char buf[80];
+      static char buf[128];
+      int size;
 
-      sprintf (buf, "process %ld, lwp %ld", (long)pid, (long)lwpid);
+      size = snprintf (buf, sizeof buf, "process %ld, lwp %ld",
+                      (long)pid, (long)lwpid);
+      gdb_assert (size < sizeof buf);
       return buf;
     }
 
index 317a7d53fb9415a48f95f2f0c9d51a5a14a1d648..ed57631ac80fb69228508900b2613b2de25fcc57 100644 (file)
@@ -5322,9 +5322,11 @@ Fetch and print the remote list of thread identifiers, one pkt only"));
 static char *
 remote_pid_to_str (ptid_t ptid)
 {
-  static char buf[30];
+  static char buf[32];
+  int size;
 
-  sprintf (buf, "Thread %d", PIDGET (ptid));
+  size = snprintf (buf, sizeof buf, "thread %d", ptid_get_pid (ptid));
+  gdb_assert (size < sizeof buf);
   return buf;
 }
 
index e2bb96d0ccf6c5ad73dbfb37565e31addedb2918..a0965fd3b6f5bdbb26f4835321e6d0aacf09a6e9 100644 (file)
@@ -1803,15 +1803,17 @@ store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
 int (*target_activity_function) (void);
 int target_activity_fd;
 \f
-/* Convert a normal process ID to a string.  Returns the string in a static
-   buffer.  */
+/* Convert a normal process ID to a string.  Returns the string in a
+   static buffer.  */
 
 char *
 normal_pid_to_str (ptid_t ptid)
 {
-  static char buf[30];
+  static char buf[32];
+  int size;
 
-  sprintf (buf, "process %d", PIDGET (ptid));
+  size = snprintf (buf, sizeof buf, "process %d", ptid_get_pid (ptid));
+  gdb_assert (size < sizeof buf);
   return buf;
 }