Re: [PATCH 3/3] libhandle: zero terminate fspath string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 19, 2019 at 05:33:46PM -0600, Eric Sandeen wrote:
> I had a heck of a time chasing through whether we were null terminated
> by now or not, so just be safe and do it explicitly.
> 
> Addresses-Coverity-ID: 1297520 ("Buffer not null terminated")
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

--D

> ---
> 
> diff --git a/libhandle/handle.c b/libhandle/handle.c
> index eb099f4..d3927a3 100644
> --- a/libhandle/handle.c
> +++ b/libhandle/handle.c
> @@ -108,6 +108,7 @@ path_to_fshandle(
>  
>  		fdhp->fsfd = fd;
>  		strncpy(fdhp->fspath, fspath, sizeof(fdhp->fspath));
> +		fdhp->fspath[sizeof(fdhp->fspath) - 1] = '\0';
>  		memcpy(fdhp->fsh, *fshanp, FSIDSIZE);
>  
>  		fdhp->fnxt = fdhash_head;
> 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux