[dm-devel] [PATCH v2 14/15] libmultipath: apply_format(): prevent buffer overflow

Benjamin Marzinski bmarzins at redhat.com
Mon Apr 4 20:34:49 UTC 2022


 On Mon, Apr 04, 2022 at 07:04:56PM +0200, mwilck at suse.com wrote:
> Potential overflow found by coverity (CID 376918).

Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>

> ---
>  libmultipath/callout.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libmultipath/callout.c b/libmultipath/callout.c
> index dac088c..57c3481 100644
> --- a/libmultipath/callout.c
> +++ b/libmultipath/callout.c
> @@ -160,7 +160,7 @@ int apply_format(char * string, char * cmd, struct path * pp)
>  	myfree = CALLOUT_MAX_SIZE;
>  
>  	if (!pos) {
> -		strcpy(dst, string);
> +		strlcpy(dst, string, CALLOUT_MAX_SIZE);
>  		return 0;
>  	}
>  
> -- 
> 2.35.1


More information about the dm-devel mailing list