Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 20db51d70e6b59a061db97ce9b89c771 > files > 38

net-snmp-5.3.2.2-14.el5.src.rpm

252216: sr #1708416: net-snmp segfault on RHEL5
Written-By: Jan Safranek <jsafrane@redhat.com>

The patch was accepted upstream: http://sourceforge.net/tracker/index.php?func=detail&aid=1774612&group_id=12694&atid=312694

diff -up /mibgroup/host/hr_swrun.c.proc-crash net-snmp-5.3.2.2/agent/mibgroup/host/hr_swrun.c
--- agent/mibgroup/host/hr_swrun.c.proc-crash	2007-08-16 14:03:44.000000000 +0200
+++ agent/mibgroup/host/hr_swrun.c	2008-07-10 17:13:59.000000000 +0200
@@ -724,9 +724,9 @@ 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 )
-                return NULL;    /* the process probably died */
+            cp = fgets(buf, sizeof(buf), fp);        /* Name: process name */
+            if (cp == NULL)
+                return NULL; /* the process probably died*/ 
             cp = strchr(buf, ':');
             if ( cp == NULL )
                 return NULL;    /* the process file is malformed */