fix hrSWRunPath not being returned by snmpd Resolves: #512345

This commit is contained in:
Jan Šafránek 2009-11-19 14:28:18 +00:00
parent cd308a4c99
commit ad8c3bbdc3
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,26 @@
512345: net-snmp not correctly returning hrSWRunPath
Source: upstream, SVN rev. 17460
Proper check for empty process status file.
(Avoids truncated walk of hrSWRunPath on SuSE systems)
Reported by Kamil Kisiel.
git-svn-id: https://net-snmp.svn.sourceforge.net/svnroot/net-snmp/trunk@17460 06827809-a52a-0410-b366-d66718629ded
diff --git a/net-snmp/agent/mibgroup/host/hr_swrun.c b/net-snmp/agent/mibgroup/host/hr_swrun.c
index b6ade26..71e5409 100644
--- a/net-snmp/agent/mibgroup/host/hr_swrun.c
+++ b/net-snmp/agent/mibgroup/host/hr_swrun.c
@@ -752,8 +752,7 @@ var_hrswrun(struct variable * vp,
sprintf(string, "/proc/%d/status", pid);
if ((fp = fopen(string, "r")) == NULL)
return NULL;
- fgets(buf, sizeof(buf), fp); /* Name: process name */
- if ( cp == NULL ) {
+ if (!fgets(buf, sizeof(buf), fp)) {
fclose(fp);
return NULL; /* the process probably died */
}

View File

@ -8,7 +8,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: %{major_ver}
Release: 12%{?dist}
Release: 13%{?dist}
Epoch: 1
License: BSD and MIT
@ -36,6 +36,7 @@ Patch11: net-snmp-5.4.1-sensors3.patch
Patch12: net-snmp-5.4.1-xen-crash.patch
Patch13: net-snmp-5.4.1-libwrap.patch
Patch14: net-snmp-5.4.2.1-proc-div0.patch
Patch15: net-snmp-5.4.2.1-hrswprocpath.patch
Requires(pre): chkconfig
Requires(post): chkconfig
@ -175,6 +176,7 @@ Net-SNMP toolkit library.
%patch12 -p1 -b .xen-crash
%patch13 -p1 -b .libwrap
%patch14 -p1 -b .proc-div0
%patch15 -p2 -b .hrswprocpath
# Do this patch with a perl hack...
perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh
@ -423,6 +425,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_datadir}/snmp/mibs
%changelog
* Thu Nov 19 2009 Jan Safranek <jsafrane@redhat.com> 5.4.2.1-13
- fix hrSWRunPath not being returned by snmpd (#512345)
* Mon May 18 2009 Jan Safranek <jsafranek@redhat.com> 5.4.2.1-12
- fix divison-by-zero in cpu statistics (#501210)