[CRIU] [crtools-bot for Cyrill Gorcunov ] util-net: Make sure that there is real data in message

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 14 08:18:09 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 39976326c97fd8fb1e09af341193d2269fc31f6a
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date:   Mon Feb 13 21:46:35 2012 +0400

    util-net: Make sure that there is real data in message
    
    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);


More information about the CRIU mailing list