Check for bogus file descriptor tables.

This commit is contained in:
mycroft 1995-02-15 02:10:41 +00:00
parent 03137e0abf
commit afd89ee68e
1 changed files with 7 additions and 1 deletions

View File

@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)fstat.c 8.1 (Berkeley) 6/6/93";*/
static char *rcsid = "$Id: fstat.c,v 1.12 1994/12/24 16:38:43 cgd Exp $";
static char *rcsid = "$Id: fstat.c,v 1.13 1995/02/15 02:10:41 mycroft Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -311,6 +311,12 @@ dofiles(kp)
p->p_fd, Pid);
return;
}
if (filed.fd_nfiles < 0 || filed.fd_lastfile >= filed.fd_nfiles ||
filed.fd_freefile > filed.fd_lastfile + 1) {
dprintf(stderr, "filedesc corrupted at %x for pid %d\n",
p->p_fd, Pid);
return;
}
/*
* root directory vnode, if one
*/