]> git.pld-linux.org Git - packages/cscope.git/commitdiff
- new (fixes insecure creation of temporary files vulnerability)
authorAdam Gołębiowski <adamg@pld-linux.org>
Thu, 16 Dec 2004 22:50:59 +0000 (22:50 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cscope-CAN-2004-0996.patch -> 1.1

cscope-CAN-2004-0996.patch [new file with mode: 0644]

diff --git a/cscope-CAN-2004-0996.patch b/cscope-CAN-2004-0996.patch
new file mode 100644 (file)
index 0000000..4084b13
--- /dev/null
@@ -0,0 +1,38 @@
+--- cscope-15.3.orig/src/main.c
++++ cscope-15.3/src/main.c
+@@ -336,9 +336,32 @@
+       }
+       /* create the temporary file names */
+-      pid = getpid();
+-      (void) sprintf(temp1, "%s/cscope%d.1", tmpdir, pid);
+-      (void) sprintf(temp2, "%s/cscope%d.2", tmpdir, pid);
++      do {
++              char *tempfile = tempnam(tmpdir, "cscope1");
++              if (!tempfile) {
++                      fprintf (stderr, "Can't create tempfile\n");
++                      exit(1);
++              }
++              if (strlen(tempfile) >= sizeof(temp1)) {
++                      fprintf (stderr, "TMPDIR path is too long\n");
++                      exit(1);
++              }
++              strncpy (temp1, tempfile, sizeof (temp1));
++              free (tempfile);
++      } while (open (temp1, O_CREAT|O_EXCL|O_WRONLY, S_IREAD|S_IWRITE) < 0);
++      do {
++              char *tempfile = tempnam(tmpdir, "cscope2");
++              if (!tempfile) {
++                      fprintf (stderr, "Can't create tempfile\n");
++                      exit(1);
++              }
++              if (strlen(tempfile) >= sizeof(temp2)) {
++                      fprintf (stderr, "TMPDIR path is too long\n");
++                      exit(1);
++              }
++              strncpy (temp2, tempfile, sizeof (temp2));
++              free (tempfile);
++      } while (open (temp2, O_CREAT|O_EXCL|O_WRONLY, S_IREAD|S_IWRITE) < 0);
+       /* if running in the foreground */
+       if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
This page took 0.144553 seconds and 4 git commands to generate.