[finger/f18] finger segfaults if pw->pw_gecos is NULL (#866873)

Tomas Hozza thozza at fedoraproject.org
Tue Oct 16 08:42:43 UTC 2012


commit 06190288226625a2bcfc92f498fa135145213528
Author: Tomas Hozza <thozza at redhat.com>
Date:   Tue Oct 16 10:39:38 2012 +0200

    finger segfaults if pw->pw_gecos is NULL (#866873)

 bsd-finger-0.17-match_sigsegv.patch |   13 +++++++++++++
 finger.spec                         |    7 ++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/bsd-finger-0.17-match_sigsegv.patch b/bsd-finger-0.17-match_sigsegv.patch
new file mode 100644
index 0000000..f9fd99d
--- /dev/null
+++ b/bsd-finger-0.17-match_sigsegv.patch
@@ -0,0 +1,13 @@
+diff -up bsd-finger-0.17/finger/util.c.match_sigsegv bsd-finger-0.17/finger/util.c
+--- bsd-finger-0.17/finger/util.c.match_sigsegv	2012-10-16 10:22:26.240480338 +0200
++++ bsd-finger-0.17/finger/util.c	2012-10-16 10:26:15.744072682 +0200
+@@ -186,6 +186,9 @@ match(struct passwd *pw, const char *use
+ 	int i, j, ct, rv=0;
+ 	char *rname;
+ 
++	if (pw == NULL || pw->pw_gecos == NULL)
++		return 0;
++
+ 	strncpy(tbuf, pw->pw_gecos, TBUFLEN);
+ 	tbuf[TBUFLEN-1] = 0;  /* guarantee null termination */
+ 	p = tbuf;
diff --git a/finger.spec b/finger.spec
index 8d0aef6..3382a55 100644
--- a/finger.spec
+++ b/finger.spec
@@ -1,7 +1,7 @@
 Summary: The finger client
 Name: finger
 Version: 0.17
-Release: 45%{?dist}
+Release: 46%{?dist}
 License: BSD
 Group: Applications/Internet
 Source: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/bsd-finger-%{version}.tar.gz
@@ -20,6 +20,7 @@ Patch9: bsd-finger-0.17-utmp.patch
 Patch10: bsd-finger-wide-char-support5.patch
 Patch11: bsd-finger-0.17-init-realname.patch
 Patch12: bsd-finger-0.17-host-info.patch
+Patch13: bsd-finger-0.17-match_sigsegv.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: glibc-devel
 
@@ -61,6 +62,7 @@ and you'd like finger information to be available.
 %patch10 -p1 -b .widechar
 %patch11 -p1 
 %patch12 -p1 -b .host
+%patch13 -p1 -b .match_sigsegv
 
 install -m 644 %SOURCE2 COPYING
 
@@ -106,6 +108,9 @@ rm -rf ${RPM_BUILD_ROOT}
 %doc COPYING
 
 %changelog
+* Tue Oct 16 2012 Tomas Hozza <thozza at redhat.com> - 0.17-46
+- finger segfaults if pw->pw_gecos is NULL (#866873)
+
 * Thu Jul 19 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.17-45
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list