Date: Fri, 1 Mar 2002 06:20:02 -0800 (PST) From: "Simon 'corecode' Schubert" <corecode@corecode.ath.cx> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/35451: PATCH: pkg_add -r able to save local copy to PKG_SAVEDIR Message-ID: <200203011420.g21EK2b65078@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/35451; it has been noted by GNATS. From: "Simon 'corecode' Schubert" <corecode@corecode.ath.cx> To: Mark Hannon <markhannon@optushome.com.au> 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 <markhannon@optushome.com.au> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203011420.g21EK2b65078>