From 39906ef201ec64ccff1730913c4e85c77f7e67ac Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 4 Aug 2009 23:50:56 +0000 Subject: [PATCH] - Fix a buffer overflow --- psmisc-22.6-overflow2.patch | 20 ++++++++++++++++++++ psmisc.spec | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 psmisc-22.6-overflow2.patch diff --git a/psmisc-22.6-overflow2.patch b/psmisc-22.6-overflow2.patch new file mode 100644 index 0000000..8e563bf --- /dev/null +++ b/psmisc-22.6-overflow2.patch @@ -0,0 +1,20 @@ +Fix an off-by overflow one that would trigger a FORTIFY_SOURCE abort. + +Lubomir Rintel + +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) { diff --git a/psmisc.spec b/psmisc.spec index a883cd3..1e90d0e 100644 --- a/psmisc.spec +++ b/psmisc.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing processes on your system Name: psmisc Version: 22.6 -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv2+ Group: Applications/System Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz @@ -14,6 +14,7 @@ Patch0: psmisc-22.6-types.patch Patch1: psmisc-22.6-pstree-overflow.patch #fix #497303 Patch2: psmisc-22.6-fuser-remove-mountlist.patch +Patch3: psmisc-22.6-overflow2.patch BuildRequires: libselinux-devel BuildRequires: gettext @@ -33,6 +34,7 @@ of processes that are using specified files or filesystems. %patch0 -p1 -b .types %patch1 -p1 -b .overflow %patch2 -p1 -b .mount +%patch3 -p1 -b .overflow2 %build export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" @@ -73,6 +75,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Wed Aug 05 2009 Lubomir Rintel - 22.6-13 +- Fix a buffer overflow + * Sun Jul 26 2009 Fedora Release Engineering - 22.6-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild