- fix the problem in get_nfs_mount_nr function ( iostat -n causes stack

smashing)
This commit is contained in:
Ivana Varekova 2009-12-11 10:41:10 +00:00
parent 51be4f223a
commit cb15beb6ca
2 changed files with 34 additions and 1 deletions

27
sysstat-9.0.6-nfs.patch Normal file
View File

@ -0,0 +1,27 @@
diff -up sysstat-9.0.6/common.c.pom sysstat-9.0.6/common.c
--- sysstat-9.0.6/common.c.pom 2009-09-12 20:59:04.000000000 +0200
+++ sysstat-9.0.6/common.c 2009-12-11 11:20:41.000000000 +0100
@@ -275,7 +275,6 @@ int get_nfs_mount_nr(void)
{
FILE *fp;
char line[8192];
- char type_name[10];
unsigned int nfs = 0;
if ((fp = fopen(NFSMOUNTSTATS, "r")) == NULL)
@@ -285,12 +284,9 @@ int get_nfs_mount_nr(void)
while (fgets(line, 8192, fp) != NULL) {
if ((strstr(line, "mounted")) && (strstr(line, "on")) &&
- (strstr(line, "with")) && (strstr(line, "fstype"))) {
-
- sscanf(strstr(line, "fstype") + 6, "%10s", type_name);
- if ((!strncmp(type_name, "nfs", 3)) && (strncmp(type_name, "nfsd", 4))) {
- nfs ++;
- }
+ (strstr(line, "with fstype nfs")) &&
+ !(strstr(line, "with fstype nfsd"))) {
+ nfs++;
}
}

View File

@ -1,12 +1,13 @@
Name: sysstat
Version: 9.0.6
Release: 1%{?dist}
Release: 2%{?dist}
Summary: The sar and iostat system monitoring commands
License: GPLv2+
Group: Applications/System
URL: http://perso.orange.fr/sebastien.godard/
Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.bz2
Patch0: sysstat-9.0.4-init_script.patch
Patch1: sysstat-9.0.6-nfs.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -23,6 +24,7 @@ activity.
%prep
%setup -q
%patch0 -p1 -b .ii
%patch1 -p1 -b .nfs
iconv -f windows-1252 -t utf8 CREDITS > CREDITS.aux
mv CREDITS.aux CREDITS
@ -74,6 +76,10 @@ rm -rf %{buildroot}
%{_localstatedir}/log/sa
%changelog
* Fri Dec 11 2009 Ivana Hutarova Varekova <varekova@redhat.com> - 9.0.6-2
- fix the problem in get_nfs_mount_nr function
( iostat -n causes stack smashing)
* Wed Dec 2 2009 Ivana Hutarva Varekova <varekova@redhat.com> - 9.0.6-1
- update to 9.0.6