openbsd-ports/devel/ddd/patches/patch-ddd_print_C
espie 5c56db06a3 Fix tmpnam() holes in ddd.
Quick and dirty patches that do the job, a cleaner version
to contribute back to ddd's authors will appear shortly.
2000-10-30 13:54:50 +00:00

18 lines
630 B
Plaintext

$OpenBSD: patch-ddd_print_C,v 1.1 2000/10/30 13:54:51 espie Exp $
--- ddd/print.C.orig Mon Oct 30 13:36:27 2000
+++ ddd/print.C Mon Oct 30 13:39:17 2000
@@ -212,7 +212,12 @@ static void printOutputHP(Agent *, void
static int print_to_printer(string command, PrintGC& gc,
bool selectedOnly, bool displays)
{
- string tempfile = tmpnam(0);
+ char temp_name[] = "/tmp/ddd.XXXXXXXXXX";
+ int temp_fd = mkstemp(temp_name);
+ if (temp_fd == -1)
+ return 1;
+ close(temp_fd);
+ string tempfile = temp_name;
int ret = print_to_file(tempfile, gc, selectedOnly, displays);
if (ret)
return ret;