From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2130.oracle.com ([141.146.126.79]:50162 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725796AbfBTR0T (ORCPT ); Wed, 20 Feb 2019 12:26:19 -0500 Date: Wed, 20 Feb 2019 09:26:14 -0800 From: "Darrick J. Wong" Subject: Re: [PATCH 3/3] libhandle: zero terminate fspath string Message-ID: <20190220172614.GO32253@magnolia> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: Eric Sandeen Cc: linux-xfs 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 Looks ok, Reviewed-by: Darrick J. Wong --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; >