From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.sgi.com (relay1.corp.sgi.com [137.38.102.111]) by oss.sgi.com (Postfix) with ESMTP id E28757F3F for ; Mon, 9 Jun 2014 08:02:42 -0500 (CDT) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay1.corp.sgi.com (Postfix) with ESMTP id D7C7B8F8049 for ; Mon, 9 Jun 2014 06:02:39 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id K9iG2w3vP00GE0wu for ; Mon, 09 Jun 2014 06:02:38 -0700 (PDT) Date: Mon, 9 Jun 2014 09:02:36 -0400 From: Brian Foster Subject: Re: [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated Message-ID: <20140609130235.GA31319@bfoster.bfoster> References: <53922B49.1050005@redhat.com> <53922C8E.3050700@sandeen.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <53922C8E.3050700@sandeen.net> List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: Eric Sandeen Cc: Eric Sandeen , xfs-oss On Fri, Jun 06, 2014 at 04:03:10PM -0500, Eric Sandeen wrote: > Ensure that the string we read from leftofffile is NULL > terminated; the buffer gets passed to strchr(), so > it's important that we ensure it ends with NULL. > > Signed-off-by: Eric Sandeen > --- > > diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c > index 3818f02..94d235c 100644 > --- a/fsr/xfs_fsr.c > +++ b/fsr/xfs_fsr.c > @@ -554,6 +554,8 @@ fsrallfs(char *mtab, int howlong, char *leftofffile) > fsrprintf(_("could not read %s, starting with %s\n"), > leftofffile, *fs->dev); > } else { > + /* Ensure the buffer we read is null terminated */ > + buf[SMBUFSZ-1] = '\0'; Maybe just initialize the buffer..? Brian > for (fs = fsbase; fs < fsend; fs++) { > fsname = fs->dev; > if ((strncmp(buf,fsname,strlen(fsname)) == 0) > > _______________________________________________ > xfs mailing list > xfs@oss.sgi.com > http://oss.sgi.com/mailman/listinfo/xfs _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs