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

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);
}