- Fix a buffer overflow

This commit is contained in:
Lubomir Rintel 2009-08-04 23:50:56 +00:00
parent 8436576280
commit 39906ef201
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,20 @@
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) {

View File

@ -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 <lkundrak@v3.sk> - 22.6-13
- Fix a buffer overflow
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 22.6-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild