Date: Sun, 14 Jan 1996 12:34:30 -0500 (EST) From: Sujal Patel <smpatel@wam.umd.edu> To: Bruce Evans <bde@zeta.org.au> Cc: freebsd-bugs@freefall.freebsd.org Subject: Re: ports/944: Security fixes for Fvwm 1.24r Message-ID: <Pine.BSF.3.91.960114122859.818E-100000@sl-015.sl.cybercomm.net> In-Reply-To: <199601140740.XAA19336@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 13 Jan 1996, Bruce Evans wrote: > >+ /* make a directory to guard against following symlinks */ > >+ if (mkdir(tmp_name, 0700) != 0) { > >+ perror("exclusive open for tmp_name failed in m4_defs"); > >+ exit(0377); > >+ } > >+ strcat(tmp_name, "/data"); /* what actual tmp file is to be called */ > > I think the O_EXCL method is better. Except of course if you really > want a directory or another type of non-regular file. It's surprisingly > hard to get the interface for temporary file [name] creation right. > FreeBSD has 5 BAD interfaces: tempnam(), tmpfile(), tmpnam(), mktemp() > and mkstemp(). I didn't like the idea of making a directory either. It looked pretty ugly when I first looked at this patch-- But there is precedent for this kind of protection (even in BSD code: df.c). Also, this temporary file is going to be used when FVWM runs 'm4 > tempfile', so this doesn't allow the use of mkstemp(). Overall, this whole part of FVWM is a big ugly mess-- But at least this fixes the security problems. Sujal
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.960114122859.818E-100000>