27 lines
1.0 KiB
Diff
27 lines
1.0 KiB
Diff
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 */
|
|
}
|