Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > media > main-updates-src > by-pkgid > 42b41bd87961f2beb9305276e87bfe95 > files > 4

procps-3.2.7-3.1mdv2007.1.src.rpm

2007-03-10  Gwenole Beauchesne  <gbeauchesne@mandriva.com>

	* sysctl.c (ReadSetting): Allocate one more byte for trailing
	slash, aka fix buffer overflow.

--- procps-3.2.7/sysctl.c.fix-buffer-overflow	2007-03-10 12:11:31.000000000 +0100
+++ procps-3.2.7/sysctl.c	2007-03-10 12:12:19.000000000 +0100
@@ -136,7 +136,7 @@ static int ReadSetting(const char *restr
    }
 
    /* used to open the file */
-   tmpname = malloc(strlen(name)+strlen(PROC_PATH)+1);
+   tmpname = malloc(strlen(name)+strlen(PROC_PATH)+2);
    strcpy(tmpname, PROC_PATH);
    strcat(tmpname, name); 
    slashdot(tmpname+strlen(PROC_PATH),'.','/'); /* change . to / */