Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Apr 2001 17:44:13 -0400 (EDT)
From:      Mike Heffner <mheffner@vt.edu>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        bug-gnats@gnu.org, pst@FreeBSD.ORG, audit@FreeBSD.ORG
Subject:   Re: GNATS tempfile patch
Message-ID:  <XFMail.20010425174413.mheffner@vt.edu>
In-Reply-To: <20010425023740.C54713@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format
--_=XFMail.1.4.7.FreeBSD:20010425174413:436=_
Content-Type: text/plain; charset=us-ascii


On 25-Apr-2001 Kris Kennaway wrote:
| ..and here's part II, fixing the C code to use mkstemp() if available,
| instead of mktemp().  Please review, etc.
|
| --- gnats/cmds.c.orig Wed Mar 17 15:45:36 1999
| +++ gnats/cmds.c      Wed Apr 25 02:24:59 2001
| @@ -121,19 +121,33 @@

[snip]
  
| +#ifdef HAVE_MKSTEMP
| +  if ((tf = fdopen (fd, "w")) == (FILE *) NULL)
| +#else
|    if ((tf = fopen (path, "w")) == (FILE *) NULL)
| +#endif

If we're using mkstemp(), we could get here and the fdopen() could fail, but we
still have created the tempfile. I think there needs to be an unlink() within
#ifdef HAVE_MKSTEMP to remove the file on failure.


| --- gnats/internal.c.orig     Tue Mar  2 16:18:53 1999
| +++ gnats/internal.c  Wed Apr 25 02:24:45 2001
| @@ -36,20 +36,38 @@

[snip]

| +#ifdef HAVE_MKSTEMP
| +  fp = fdopen (fd, "w");
| +#else
|    fp = fopen (workfile, "w");
| +#endif
|    if (fp == NULL)

Same here.

Otherwise, looks good =)


Mike

-- 
  Mike Heffner       <mheffner@vt.edu>
  Blacksburg, VA   <mikeh@FreeBSD.org>
  http://filebox.vt.edu/users/mheffner


--_=XFMail.1.4.7.FreeBSD:20010425174413:436=_
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE650UtFokZQs3sv5kRAq4qAJ9nQlVphhFDDatZQTBnyTyaOcDvpACgjeou
XegNmcQYZC4wF5LL1h/Qpbo=
=b5I7
-----END PGP SIGNATURE-----

--_=XFMail.1.4.7.FreeBSD:20010425174413:436=_--
End of MIME message

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20010425174413.mheffner>