From owner-cvs-all Mon Mar 18 7:34:32 2002 Delivered-To: cvs-all@freebsd.org Received: from aldan.algebra.com (aldan.algebra.com [216.254.65.224]) by hub.freebsd.org (Postfix) with ESMTP id 3DCF737B431; Mon, 18 Mar 2002 07:34:15 -0800 (PST) Received: from aldan.algebra.com (localhost [127.0.0.1]) by aldan.algebra.com (8.12.2/8.12.2) with ESMTP id g2IFYN3b020895; Mon, 18 Mar 2002 10:34:32 -0500 (EST) (envelope-from mi@aldan.algebra.com) Message-Id: <200203181534.g2IFYN3b020895@aldan.algebra.com> Date: Mon, 18 Mar 2002 10:34:23 -0500 (EST) From: Mikhail Teterin Subject: Re: cvs commit: src/libexec/xtend user.c xtend.c To: roam@ringlet.net Cc: imp@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org In-Reply-To: <20020318141639.B1326@straylight.oblivion.bg> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 18 Mar, Peter Pentchev wrote: > On Sun, Mar 17, 2002 at 11:14:59PM -0800, Warner Losh wrote: >> imp 2002/03/17 23:14:59 PST >> >> Modified files: >> libexec/xtend user.c xtend.c >> Log: >> o MAXPATHLEN is the correct constant to use for path names, it includes >> the NULL. >> o use snprintf in preference to unchecked strcat in a couple of places that >> likely can't overflow. Makes it easier to grep for strcpy :-) > > /me sprinkles some magic comma dust over the naughty-naughty imp :) > [IOW, please try the attached patch :] Since the X10DIR and X10DUMPNAME are both known at compile time, why not - snprintf(dumppath, sizeof(dumppath), "%s/%s", X10DIR, X10DUMPNAME); + strncpy(dumppath, X10DIR "/" X10DUMPNAME, sizeof(dumppath)); and so on? (The plain strcpy would do just fine here too, IMO :) -mi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message