[CRIU] [PATCH] parasite: Make sure that there is real data in message

Cyrill Gorcunov gorcunov at openvz.org
Mon Feb 13 05:09:38 EST 2012


Otherwise weird address might be dereferenced.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 parasite.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/parasite.c b/parasite.c
index 2db0ebb..d024de2 100644
--- a/parasite.c
+++ b/parasite.c
@@ -88,7 +88,7 @@ static 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