https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79309

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |build, patch

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The following patch fixes the problem:

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 54a1d6e..483997f 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3401,9 +3401,8 @@ void __gnat_killprocesstree (int pid, int sig_num)

           /* read /proc/<PID>/stat */

-          strncpy (statfile, "/proc/", sizeof(statfile));
-          strncat (statfile, d->d_name, sizeof(statfile));
-          strncat (statfile, "/stat", sizeof(statfile));
+          sprintf (statfile, "/proc/%.*s/stat",
+                  (int)(sizeof statfile - 12), d->d_name);

           FILE *fd = fopen (statfile, "r");

Reply via email to