tags 480972 + patch
thanks

Hi,
I wrote a patch to fix this. I have no idea how to test this 
specific functionality so it would be nice if someone could 
do this before uploading it.

Patch attached.

Kind regards
Nico

-- 
Nico Golde - http://www.ngolde.de - [EMAIL PROTECTED] - GPG: 0x73647CFF
For security reasons, all text in this mail is double-rot13 encrypted.
diff -u uudeview-0.5.20/uulib/uunconc.c uudeview-0.5.20/uulib/uunconc.c
--- uudeview-0.5.20/uulib/uunconc.c
+++ uudeview-0.5.20/uulib/uunconc.c
@@ -1311,6 +1311,8 @@
   char *mode, *ntmp;
   uufile *iter;
   size_t bytes;
+  char tmpfile[] = "/tmp/uuXXXXXX";
+  int fd = -1;
 
   if (data == NULL || data->thisfile == NULL)
     return UURET_ILLVAL;
@@ -1329,25 +1331,16 @@
   else
     mode = "wbx";	/* otherwise in binary          */
 
-  if ((data->binfile = tempnam (NULL, "uu")) == NULL) {
-    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-	       uustring (S_NO_TEMP_NAME));
-    return UURET_NOMEM;
-  }
-
-  if ((dataout = fopen (data->binfile, mode)) == NULL) {
-    /*
-     * we couldn't create a temporary file. Usually this means that TMP
-     * and TEMP aren't set
-     */
-    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-	       uustring (S_WR_ERR_TARGET),
-	       data->binfile, strerror (uu_errno = errno));
-    _FP_free (data->binfile);
-    data->binfile = NULL;
+  if((fd = mkstemp(tmpfile)) == -1 || (dataout = fdopen(fd, "w+")) == NULL){
+    if(fd != -1){
+        unlink(tmpfile);
+        close(fd);
+    }
+    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, uustring (S_WR_ERR_TARGET), tmpfile, strerror (uu_errno = errno));
     uu_errno = errno;
     return UURET_IOERR;
   }
+
   /*
    * we don't have begin lines in Base64 or plain text files.
    */
@@ -1475,6 +1468,9 @@
     res = UURET_IOERR;
   }
 
+  unlink(tmpfile);
+  close(fd);
+
   if (res != UURET_OK || (state != DONE && !uu_desperate)) {
     unlink (data->binfile);
     _FP_free (data->binfile);

Attachment: pgpVNUScoPYd6.pgp
Description: PGP signature

Reply via email to