[CRIU] [PATCH 11/16] util-net: Make sure that there is real data in message

Cyrill Gorcunov gorcunov at openvz.org
Mon Feb 13 14:26:34 EST 2012


Otherwise weird address might be dereferenced.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
Acked-by: Pavel Emelyanov <xemul at parallels.com>
---
 util-net.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/util-net.c b/util-net.c
index 4f826ca..dad02c4 100644
--- a/util-net.c
+++ b/util-net.c
@@ -57,7 +57,7 @@ int recv_fd(int sock)
 		return ret;
 
 	cmsg = CMSG_FIRSTHDR(&msg);
-	if (!cmsg->cmsg_type == SCM_RIGHTS)
+	if (!cmsg || !cmsg->cmsg_type == SCM_RIGHTS)
 		return -2;
 
 	cmsg_data = (int *)CMSG_DATA(cmsg);
-- 
1.7.7.6



More information about the CRIU mailing list