Prevent passing a null pointer as a filename to vn_open(),

if for some reason expand_name() failed to build a core file name.

PR:		29931
Submitted by:	Foldi Tamas <crow@kapu.hu>
Reviewed by:	dd, -arch
MFC after:	1 month
This commit is contained in:
Peter Pentchev 2001-08-24 15:49:30 +00:00
parent 1a939a075f
commit ccdbd10cb7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82278

View File

@ -1793,6 +1793,8 @@ coredump(p)
restart:
name = expand_name(p->p_comm, p->p_ucred->cr_uid, p->p_pid);
if (name == NULL)
return (EINVAL);
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, p);
flags = O_CREAT | FWRITE | O_NOFOLLOW;
error = vn_open(&nd, &flags, S_IRUSR | S_IWUSR);