From 4ff29482eb8d67e49334822ea7dca21affbd9254 Mon Sep 17 00:00:00 2001 From: Tomas Smetana Date: Mon, 11 Feb 2008 10:41:13 +0000 Subject: [PATCH] - fix #432330 segfault on corrupted status file --- logrotate-3.7.6-segfault.patch | 52 ++++++++++++++++++++++++++++++++++ logrotate.spec | 8 +++++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 logrotate-3.7.6-segfault.patch diff --git a/logrotate-3.7.6-segfault.patch b/logrotate-3.7.6-segfault.patch new file mode 100644 index 0000000..6aa40ae --- /dev/null +++ b/logrotate-3.7.6-segfault.patch @@ -0,0 +1,52 @@ +diff -up logrotate-3.7.6/logrotate.c.segfault logrotate-3.7.6/logrotate.c +--- logrotate-3.7.6/logrotate.c.segfault 2008-02-11 11:33:52.000000000 +0100 ++++ logrotate-3.7.6/logrotate.c 2008-02-11 11:34:59.000000000 +0100 +@@ -1325,7 +1325,7 @@ static int readState(char *stateFilename + { + FILE *f; + char buf[1024]; +- const char **argv; ++ const char **argv = NULL; + int argc; + int year, month, day; + int i; +@@ -1409,7 +1409,8 @@ static int readState(char *stateFilename + message(MESS_ERROR, + "bad year %d for file %s in state file %s\n", year, + argv[0], stateFilename); +- free(argv); ++ if(argv) ++ free(argv); + fclose(f); + return 1; + } +@@ -1418,7 +1419,8 @@ static int readState(char *stateFilename + message(MESS_ERROR, + "bad month %d for file %s in state file %s\n", month, + argv[0], stateFilename); +- free(argv); ++ if(argv) ++ free(argv); + fclose(f); + return 1; + } +@@ -1428,7 +1430,8 @@ static int readState(char *stateFilename + message(MESS_ERROR, + "bad day %d for file %s in state file %s\n", day, + argv[0], stateFilename); +- free(argv); ++ if(argv) ++ free(argv); + fclose(f); + return 1; + } +@@ -1445,7 +1448,8 @@ static int readState(char *stateFilename + lr_time = mktime(&st->lastRotated); + st->lastRotated = *localtime(&lr_time); + +- free(argv); ++ if(argv) ++ free(argv); + } + + fclose(f); diff --git a/logrotate.spec b/logrotate.spec index afd5af9..0a7ca7c 100644 --- a/logrotate.spec +++ b/logrotate.spec @@ -1,7 +1,7 @@ Summary: Rotates, compresses, removes and mails system log files Name: logrotate Version: 3.7.6 -Release: 2.2%{?dist} +Release: 3%{?dist} License: GPL+ Group: System Environment/Base # The source for this package was pulled from cvs. @@ -13,6 +13,8 @@ Group: System Environment/Base # make create-archive Source: logrotate-%{version}.tar.gz Patch1: logrotate-3.7.6-selinux.patch +Patch2: logrotate-3.7.6-segfault.patch + Requires: coreutils >= 5.92 libsepol libselinux popt BuildRequires: libselinux-devel popt-devel BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -31,6 +33,7 @@ log files on your system. %prep %setup -q %patch1 -p1 -b .selinux +%patch2 -p1 -b .segfault %build make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes @@ -60,6 +63,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status %changelog +* Mon Feb 11 2008 Tomas Smetana 3.7.6-3 +- fix #432330 segfault on corrupted status file + * Mon Jan 21 2008 Tomas Smetana 3.7.6-2.2 - fix #429454 - logrotate fails due to invalid pointer