summaryrefslogtreecommitdiff
path: root/devel/gtexinfo/patches/patch-al
blob: 5097a8f3c829e64c73f4738a395f1da833cb1992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$NetBSD: patch-al,v 1.1 2005/10/10 15:14:49 salo Exp $

Security fix for CAN-2005-3011, from Ubuntu.

--- util/texindex.c.orig	2004-04-11 19:56:47.000000000 +0200
+++ util/texindex.c	2005-10-10 16:46:44.000000000 +0200
@@ -390,11 +390,12 @@
 maketempname (int count)
 {
   static char *tempbase = NULL;
+  char *tempname;
   char tempsuffix[10];
+  int fd;
 
   if (!tempbase)
     {
-      int fd;
       tempbase = concat (tempdir, "txidxXXXXXX");
 
       fd = mkstemp (tempbase);
@@ -403,7 +404,12 @@
     }
 
   sprintf (tempsuffix, ".%d", count);
-  return concat (tempbase, tempsuffix);
+  tempname = concat (tempbase, tempsuffix);
+  fd = open (tempname, O_CREAT|O_EXCL|O_WRONLY, 0600);
+  if (fd == -1)
+    pfatal_with_name (tempname);
+  close (fd);
+  return tempname;
 }