[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: [Bug ada/79309] incorrectly bounded calls to strncat in adaint.c
From: "msebor at gcc dot gnu.org" <gcc-bugzilla () gcc ! gnu ! org>
Date: 2017-01-31 20:37:57
Message-ID: bug-79309-4-6DAQPsO202 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]
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");=
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic