Fix (static) buffer overflow bug. The dest buffer is of size MAXPATHLEN,

so dest[MAXPATHLEN] falls outside the buffer.  This bug corrupted
arenas[0] defined in libc's malloc.c on PowerPC when kldxref is shared,
which triggered a delayed SIGSERV.
This commit is contained in:
marcel 2006-08-04 21:28:42 +00:00
parent bc6ab54808
commit 5fae7020fe

View File

@ -260,7 +260,7 @@ maketempfile(char *dest, const char *root)
int fd;
strncpy(dest, root, MAXPATHLEN - 1);
dest[MAXPATHLEN] = '\0';
dest[MAXPATHLEN-1] = '\0';
if ((p = strrchr(dest, '/')) != 0)
p++;