Commit 39976326 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

util-net: Make sure that there is real data in message

Otherwise weird address might be dereferenced.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f130df92
...@@ -57,7 +57,7 @@ int recv_fd(int sock) ...@@ -57,7 +57,7 @@ int recv_fd(int sock)
return ret; return ret;
cmsg = CMSG_FIRSTHDR(&msg); cmsg = CMSG_FIRSTHDR(&msg);
if (!cmsg->cmsg_type == SCM_RIGHTS) if (!cmsg || !cmsg->cmsg_type == SCM_RIGHTS)
return -2; return -2;
cmsg_data = (int *)CMSG_DATA(cmsg); cmsg_data = (int *)CMSG_DATA(cmsg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment