21 lines
811 B
Diff
21 lines
811 B
Diff
Fix an off-by overflow one that would trigger a FORTIFY_SOURCE abort.
|
|
|
|
Lubomir Rintel <lkundrak@v3.sk>
|
|
|
|
diff -up psmisc-22.6/src/pstree.c.overflow2 psmisc-22.6/src/pstree.c
|
|
--- psmisc-22.6/src/pstree.c.overflow2 2009-08-05 01:38:32.000000000 +0200
|
|
+++ psmisc-22.6/src/pstree.c 2009-08-05 01:45:09.000000000 +0200
|
|
@@ -641,10 +641,10 @@ read_proc (void)
|
|
|
|
if ((taskdir=opendir(taskpath))!=0) {
|
|
/* if we have this dir, we're on 2.6 */
|
|
- if (!(threadname = malloc(strlen(comm) + 3))) {
|
|
+ if (!(threadname = malloc(COMM_LEN + 1))) {
|
|
exit (2);
|
|
}
|
|
- sprintf(threadname,"{%s}",comm);
|
|
+ sprintf(threadname,"{%.*s}", COMM_LEN - 2, comm);
|
|
while ((dt = readdir(taskdir)) != NULL) {
|
|
if ((thread=atoi(dt->d_name)) !=0) {
|
|
if (thread != pid) {
|