From owner-cvs-all Mon Mar 18 4:19:49 2002 Delivered-To: cvs-all@freebsd.org Received: from straylight.ringlet.net (discworld.nanolink.com [217.75.135.248]) by hub.freebsd.org (Postfix) with SMTP id B7DC237B404 for ; Mon, 18 Mar 2002 04:17:40 -0800 (PST) Received: (qmail 7191 invoked by uid 1000); 18 Mar 2002 12:16:39 -0000 Date: Mon, 18 Mar 2002 14:16:39 +0200 From: Peter Pentchev To: Warner Losh Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/libexec/xtend user.c xtend.c Message-ID: <20020318141639.B1326@straylight.oblivion.bg> Mail-Followup-To: Warner Losh , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org References: <200203180714.g2I7ExE74376@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="dTy3Mrz/UPE2dbVg" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200203180714.g2I7ExE74376@freefall.freebsd.org>; from imp@FreeBSD.org on Sun, Mar 17, 2002 at 11:14:59PM -0800 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 --dTy3Mrz/UPE2dbVg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 17, 2002 at 11:14:59PM -0800, Warner Losh wrote: > imp 2002/03/17 23:14:59 PST >=20 > Modified files: > libexec/xtend user.c xtend.c=20 > 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 :] G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 This sentence would be seven words long if it were six words shorter. Index: src/libexec/xtend/user.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/libexec/xtend/user.c,v retrieving revision 1.11 diff -u -r1.11 user.c --- src/libexec/xtend/user.c 18 Mar 2002 07:14:59 -0000 1.11 +++ src/libexec/xtend/user.c 18 Mar 2002 12:04:14 -0000 @@ -89,7 +89,7 @@ fprintf(User, "OK\n"); } } else if(!strcmp("dump\n", cmd)) { - snprintf(dumppath, sizeof(dumppath), "%s/%s" X10DIR, X10DUMPNAME); + snprintf(dumppath, sizeof(dumppath), "%s/%s", X10DIR, X10DUMPNAME); if((dumpf =3D fopen(dumppath, "w")) !=3D NULL) { for(h =3D 0; h < 16; h++) { for(i =3D 0; i < 16; i++) { Index: src/libexec/xtend/xtend.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/libexec/xtend/xtend.c,v retrieving revision 1.13 diff -u -r1.13 xtend.c --- src/libexec/xtend/xtend.c 18 Mar 2002 07:14:59 -0000 1.13 +++ src/libexec/xtend/xtend.c 18 Mar 2002 11:57:16 -0000 @@ -126,7 +126,7 @@ errx(1, "can't create directory '%s'", X10DIR); } } - snprintf(logpath, sizeof(logpath), "%s/%s" X10DIR, X10LOGNAME); + snprintf(logpath, sizeof(logpath), "%s/%s", X10DIR, X10LOGNAME); if((Log =3D fopen(logpath, "a")) =3D=3D NULL) errx(1, "can't open log file '%s'", logpath); chown(logpath, pw->pw_uid, gr->gr_gid); @@ -363,7 +363,7 @@ =20 fprintf(Log, "%s: SIGHUP received, reopening Log\n", thedate()); fclose(Log); - snprintf(logpath, sizeof(logpath), "%s/%s" X10DIR, X10LOGNAME); + snprintf(logpath, sizeof(logpath), "%s/%s", X10DIR, X10LOGNAME); if((Log =3D fopen(logpath, "a")) =3D=3D NULL) errx(1, "can't open log file '%s'", logpath); hup_flag =3D 0; --dTy3Mrz/UPE2dbVg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjyV2qcACgkQ7Ri2jRYZRVNa7ACfVFcpmr+vF+S8byl7pxhGSXi5 ZPoAoIdFgAKmXSbaiVWkZDnS26ptkRhX =XTdH -----END PGP SIGNATURE----- --dTy3Mrz/UPE2dbVg-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message