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

Pavel Emelyanov xemul at parallels.com
Mon Feb 13 05:30:52 EST 2012


On 02/13/2012 02:09 PM, Cyrill Gorcunov wrote:
> 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);

Ack


More information about the CRIU mailing list