From owner-freebsd-bugs Fri Mar 1 6:20:12 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0221E37B400 for ; Fri, 1 Mar 2002 06:20:03 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g21EK2b65078; Fri, 1 Mar 2002 06:20:02 -0800 (PST) (envelope-from gnats) Date: Fri, 1 Mar 2002 06:20:02 -0800 (PST) Message-Id: <200203011420.g21EK2b65078@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Simon 'corecode' Schubert" Subject: Re: bin/35451: PATCH: pkg_add -r able to save local copy to PKG_SAVEDIR Reply-To: "Simon 'corecode' Schubert" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/35451; it has been noted by GNATS. From: "Simon 'corecode' Schubert" To: Mark Hannon Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/35451: PATCH: pkg_add -r able to save local copy to PKG_SAVEDIR Date: Fri, 1 Mar 2002 15:13:11 +0100 --=.:QdE,yE7ZA68NS Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit On Fri, 1 Mar 2002 22:04:34 +1100 (EST) Mark Hannon wrote: > + /* > + * Check if PKG_SAVEDIR is set, if so then save a copy of the > + * package to that directory. > + */ > + pkg_savedir = getenv("PKG_SAVEDIR"); > + if (pkg_savedir) { > + /* > + * Set copy_short_name to $PKG_SAVEDIR/pkg_name.tgz > + */ > + strcpy(pkg_short_name, pkg_savedir); > + strcat(pkg_short_name, "/"); > + pkg_name_ptr = strrchr(fname, '/'); > + strcat(pkg_short_name, ++pkg_name_ptr); > + } do you really want to rely on the user's input (=env var) being smaller than FILENAME_MAX chars? i'd use a strn* function or a snprintf. [several other strcpys and strcats among the code] just my ¤ .02 -- /"\ http://corecode.ath.cx/ \ / \ ASCII Ribbon Campaign / \ Against HTML Mail and News --=.:QdE,yE7ZA68NS Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) iD8DBQE8f4x6r5S+dk6z85oRAiZRAJ9Mt/ogwoQZTOF3DL6cGAU3r+drzQCgnt0k TEYBeScxQ/KbYedQi7mk9Rk= =hmfV -----END PGP SIGNATURE----- --=.:QdE,yE7ZA68NS-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message