Date: Tue, 25 Jun 2002 10:20:19 +0100 From: Mark Murray <mark@grondar.za> To: Jonathan Belson <jon@witchspace.com> Cc: current@freebsd.org Subject: Re: Perl scripts that need rewiting - Any volunteers? Message-ID: <200206250920.g5P9KJnG005006@grimreaper.grondar.org> In-Reply-To: <3D17770E.1060904@witchspace.com> ; from Jonathan Belson <jon@witchspace.com> "Mon, 24 Jun 2002 20:46:22 BST." References: <3D17770E.1060904@witchspace.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> > o Please shorten any long line or comment to less than 80 columns > > This is quite tricky when using 8 character tabs. Is 4 character indent > okay for userland source? "Real" tabs are best. Look at style(9) for ways to break the long lines. It is ok to break very long lines like this; > > o Please do not use mktemp(); use mkstemp() instead. > > I used mktemp() to get a filename to redirect to, eg. > > /* Improvised example */ > char *cmd; > asprintf(cmd, "prog > %s", mktemp(blah)); > system(cmd); > free(cmd); BIG security hole. Someone can exploit a race to compromise this. > I couldn't see a simple way around this, any clues? How's this? int handle; template = "/tmp/mumbleXXXXXXXX"; char *cmd; handle = mkstemp(template); // template is modified asprintf(cmd, "prog > %s", template); system(cmd); close(handle); // bye-bye file M -- o Mark Murray \_ O.\_ Warning: this .sig is umop ap!sdn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206250920.g5P9KJnG005006>