[CRIU] [PATCH] bfd: avoid out-of-bound access

Andrei Vagin avagin at virtuozzo.com
Wed Jan 31 21:30:13 MSK 2018


Applied
On Thu, Jan 25, 2018 at 04:46:59PM -0800, Andrei Vagin wrote:
> Write a nullbyte only if there is enought space for it.
> 
> Cc: Stephen Röttger <stephen.roettger at gmail.com>
> Reported-by: Stephen Röttger <stephen.roettger at gmail.com>
> Signed-off-by: Andrei Vagin <avagin at openvz.org>
> ---
>  criu/bfd.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/criu/bfd.c b/criu/bfd.c
> index 8269ab1a2..4d54543c7 100644
> --- a/criu/bfd.c
> +++ b/criu/bfd.c
> @@ -196,6 +196,10 @@ again:
>  		if (!b->sz)
>  			return NULL;
>  
> +		if (b->sz == BUFSIZE) {
> +			pr_err("The bfd buffer is too small\n");
> +			ERR_PTR(-EIO);
> +		}
>  		/*
>  		 * Last bytes may lack the \n at the
>  		 * end, need to report this as full
> -- 
> 2.13.6
> 


More information about the CRIU mailing list