Check if there is cmsg at all.

MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2012-07-01 16:26:07 +00:00
parent d89862ac87
commit 4c13f63cba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=237931

View File

@ -181,7 +181,7 @@ proto_descriptor_recv(int sock, int *fdp)
return (errno);
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg->cmsg_level != SOL_SOCKET ||
if (cmsg == NULL || cmsg->cmsg_level != SOL_SOCKET ||
cmsg->cmsg_type != SCM_RIGHTS) {
return (EINVAL);
}