From 4c13f63cba8b4a58b0f0dc22cc80d8b4fa19871e Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sun, 1 Jul 2012 16:26:07 +0000 Subject: [PATCH] Check if there is cmsg at all. MFC after: 3 days --- sbin/hastd/proto_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/hastd/proto_common.c b/sbin/hastd/proto_common.c index 59b1e39bb2f..843366bda22 100644 --- a/sbin/hastd/proto_common.c +++ b/sbin/hastd/proto_common.c @@ -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); }