]> granicus.if.org Git - mutt/commitdiff
Pass buffer size to mutt_mktemp()
authorRocco Rutte <pdmef@gmx.net>
Sun, 21 Jun 2009 19:57:28 +0000 (21:57 +0200)
committerRocco Rutte <pdmef@gmx.net>
Sun, 21 Jun 2009 19:57:28 +0000 (21:57 +0200)
25 files changed:
attach.c
commands.c
crypt.c
editmsg.c
handler.c
headers.c
help.c
history.c
imap/message.c
main.c
mbox.c
muttlib.c
mx.c
pattern.c
pgp.c
pgpkey.c
pgpmicalg.c
pop.c
protos.h
recvattach.c
recvcmd.c
rfc3676.c
send.c
sendlib.c
smime.c

index 106d68f114783861207d69e11cbfaa946ab67cd6..238dbc2922edbcce34c987cf6f43ef927d8e1c9c 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -169,7 +169,7 @@ int mutt_compose_attachment (BODY *a)
            /* Remove headers by copying out data to another file, then 
             * copying the file back */
            fseeko (fp, b->offset, 0);
-           mutt_mktemp (tempfile);
+           mutt_mktemp (tempfile, sizeof (tempfile));
            if ((tfp = safe_fopen (tempfile, "w")) == NULL)
            {
              mutt_perror _("Failure to open file to strip headers.");
@@ -508,7 +508,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
       mutt_adv_mktemp (pagerfile, sizeof(pagerfile));
     }
     else
-      mutt_mktemp (pagerfile);
+      mutt_mktemp (pagerfile, sizeof (pagerfile));
   }
     
   if (use_mailcap)
@@ -1043,7 +1043,7 @@ int mutt_print_attachment (FILE *fp, BODY *a)
     ifp = NULL;
     fpout = NULL;
     
-    mutt_mktemp (newfile);
+    mutt_mktemp (newfile, sizeof (newfile));
     if (mutt_decode_save_attachment (fp, a, newfile, M_PRINTING, 0) == 0)
     {
       
index 7d9c90d2850dbf32a3964b96280047e75422dc59..3b009978f1511a7e38ca06d3fd42e648624d7fbf 100644 (file)
@@ -109,7 +109,7 @@ int mutt_display_message (HEADER *cur)
   }
 
 
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((fpout = safe_fopen (tempfile, "w")) == NULL)
   {
     mutt_error _("Could not create temporary file!");
diff --git a/crypt.c b/crypt.c
index 60b594d04b619f5399fcacfb2f7351a309986db3..0bd2f30519a9a9b84f4f68eaac51912d6e470848 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -593,7 +593,7 @@ void crypt_extract_keys_from_messages (HEADER * h)
   if (!WithCrypto)
     return;
 
-  mutt_mktemp (tempfname);
+  mutt_mktemp (tempfname, sizeof (tempfname));
   if (!(fpout = safe_fopen (tempfname, "w")))
   {
     mutt_perror (tempfname);
@@ -844,7 +844,7 @@ int mutt_signed_handler (BODY *a, STATE *s)
     
     if (sigcnt)
     {
-      mutt_mktemp (tempfile);
+      mutt_mktemp (tempfile, sizeof (tempfile));
       if (crypt_write_signed (a, s, tempfile) == 0)
       {
        for (i = 0; i < sigcnt; i++)
index ecba75442db9eaf236f95c92ca50623b131547f2..153b1397a9cfd471b9cab9d6b985f68731be3815 100644 (file)
--- a/editmsg.c
+++ b/editmsg.c
@@ -64,7 +64,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur)
   struct stat sb;
   time_t mtime = 0;
   
-  mutt_mktemp (tmp);
+  mutt_mktemp (tmp, sizeof (tmp));
 
   omagic = DefaultMagic;
   DefaultMagic = M_MBOX;
index 49e74ab5c5b0b850c58044e903e8723818a448b4..25e1a0d39b7837ae755ae964a033039c81c42707 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -1644,7 +1644,7 @@ int mutt_body_handler (BODY *b, STATE *s)
       {
        /* decode to a tempfile, saving the original destination */
        fp = s->fpout;
-       mutt_mktemp (tempfile);
+       mutt_mktemp (tempfile, sizeof (tempfile));
        if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
        {
          mutt_error _("Unable to open temporary file!");
index 5d22489f50c027cca9b60938e95af64fdbd28c45..72ee3eb236c612b07e1b2b1c7e3cde3ae92a4d7e 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -44,7 +44,7 @@ void mutt_edit_headers (const char *editor,
   struct stat st;
   LIST *cur, **last = NULL, *tmp;
 
-  mutt_mktemp (path);
+  mutt_mktemp (path, sizeof (path));
   if ((ofp = safe_fopen (path, "w")) == NULL)
   {
     mutt_perror (path);
diff --git a/help.c b/help.c
index 10ad9cf25b1ef670a6ed3a3ddb0420d3a3849f4e..6d54059fd69d3631b1cd48da3b306bda728f80f5 100644 (file)
--- a/help.c
+++ b/help.c
@@ -340,7 +340,7 @@ void mutt_help (int menu)
   FILE *f;
   struct binding_t *funcs;
 
-  mutt_mktemp (t);
+  mutt_mktemp (t, sizeof (t));
 
   funcs = km_get_table (menu);
   desc = mutt_getnamebyvalue (menu, Menus);
index 68528163db423d5787cb3fc48d368187a040aeaa..9efbdb47d4ad88546835f7071a25f38fc378c437 100644 (file)
--- a/history.c
+++ b/history.c
@@ -123,7 +123,7 @@ static void shrink_histfile (void)
   for(hclass = HC_FIRST; hclass < HC_LAST; hclass++)
     if (n[hclass] > SaveHist)
     {
-      mutt_mktemp (tmpfname);
+      mutt_mktemp (tmpfname, sizeof (tmpfname));
       if ((tmp = safe_fopen (tmpfname, "w+")) == NULL)
         mutt_perror (tmpfname);
       break;
index 3d64c0d5f62cc1dfd19a3b392b96192dfe81d9c4..b091152938dc3b00457d82b45581185a1cac8580 100644 (file)
@@ -102,7 +102,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
 
   /* instead of downloading all headers and then parsing them, we parse them
    * as they come in. */
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if (!(fp = safe_fopen (tempfile, "w+")))
   {
     mutt_error (_("Could not create temporary file %s"), tempfile);
@@ -437,7 +437,7 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno)
   if (!(msg->fp = msg_cache_put (idata, h)))
   {
     cache->uid = HEADER_DATA(h)->uid;
-    mutt_mktemp (path);
+    mutt_mktemp (path, sizeof (path));
     cache->path = safe_strdup (path);
     if (!(msg->fp = safe_fopen (path, "w+")))
     {
diff --git a/main.c b/main.c
index baea582e2c45b7dd5146e8c369f008220aff1a40..b8a93cceaad1967db5aedbf1873a3068e300cda8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -896,7 +896,7 @@ int main (int argc, char **argv)
       else
        fin = NULL;
 
-      mutt_mktemp (buf);
+      mutt_mktemp (buf, sizeof (buf));
       tempfile = safe_strdup (buf);
 
       if (draftFile)
diff --git a/mbox.c b/mbox.c
index 6c659ba7f2a9da7270fe23d86b4711d0cc55c1f5..e6f3f5ee954fa82c4ad298246e7093d44d4d56b4 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -769,7 +769,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
     return (-1);
 
   /* Create a temporary file to write the new version of the mailbox in. */
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((i = open (tempfile, O_WRONLY | O_EXCL | O_CREAT, 0600)) == -1 ||
       (fp = fdopen (i, "w")) == NULL)
   {
index 8539c8fa082c99d228ebe74236aa9c2cd740ac50..12dd96e026cdb915eda777f8df8ab5e1c46b19e5 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -743,9 +743,9 @@ void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra)
   mutt_free_envelope(extra);
 }
 
-void _mutt_mktemp (char *s, const char *src, int line)
+void _mutt_mktemp (char *s, size_t slen, const char *src, int line)
 {
-  snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getuid(), (int) getpid (), Counter++);
+  snprintf (s, slen, "%s/mutt-%s-%d-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getuid(), (int) getpid (), Counter++);
   dprint (3, (debugfile, "%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s));
   unlink (s);
 }
diff --git a/mx.c b/mx.c
index ec724a9256a010415a7bd0a0271b41638cb20da9..9cf245ec7f07fd8a263ab54181f1b529ad35f22f 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1201,7 +1201,7 @@ static int imap_open_new_message (MESSAGE *msg, CONTEXT *dest, HEADER *hdr)
 {
   char tmp[_POSIX_PATH_MAX];
 
-  mutt_mktemp(tmp);
+  mutt_mktemp (tmp, sizeof (tmp));
   if ((msg->fp = safe_fopen (tmp, "w")) == NULL)
   {
     mutt_perror (tmp);
index 489a1d03529530299204e70bdf9d00ca1e0f13a0..e92c95d7b9d2b49fb99f2569dd1b653b08f8a084 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -162,7 +162,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
       memset (&s, 0, sizeof (s));
       s.fpin = msg->fp;
       s.flags = M_CHARCONV;
-      mutt_mktemp (tempfile);
+      mutt_mktemp (tempfile, sizeof (tempfile));
       if ((s.fpout = safe_fopen (tempfile, "w+")) == NULL)
       {
        mutt_perror (tempfile);
diff --git a/pgp.c b/pgp.c
index 0318060c04b31056f9bd986bd10809dba0179161..ab06b7a32a2295158be0f1e337c7e76690d3f9ca 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -311,7 +311,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s)
       have_any_sigs = have_any_sigs || (clearsign && (s->flags & M_VERIFY));
 
       /* Copy PGP material to temporary file */
-      mutt_mktemp (tmpfname);
+      mutt_mktemp (tmpfname, sizeof (tmpfname));
       if ((tmpfp = safe_fopen (tmpfname, "w+")) == NULL)
       {
        mutt_perror (tmpfname);
@@ -350,7 +350,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s)
       /* Invoke PGP if needed */
       if (!clearsign || (s->flags & M_VERIFY))
       {
-       mutt_mktemp (outfile);
+       mutt_mktemp (outfile, sizeof (outfile));
        if ((pgpout = safe_fopen (outfile, "w+")) == NULL)
        {
          mutt_perror (tmpfname);
@@ -535,7 +535,7 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b, int tagged_only)
   if (tagged_only && !b->tagged)
     return 0;
 
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if (mutt_decode_save_attachment (fp, b, tempfile, 0, 0) != 0)
   {
     unlink (tempfile);
@@ -623,7 +623,7 @@ int pgp_verify_one (BODY *sigbdy, STATE *s, const char *tempfile)
   mutt_copy_bytes (s->fpin, fp, sigbdy->length);
   safe_fclose (&fp);
   
-  mutt_mktemp(pgperrfile);
+  mutt_mktemp (pgperrfile, sizeof (pgperrfile));
   if(!(pgperr = safe_fopen(pgperrfile, "w+")))
   {
     mutt_perror(pgperrfile);
@@ -682,7 +682,7 @@ void pgp_extract_keys_from_messages (HEADER *h)
       return;
   }
 
-  mutt_mktemp (tempfname);
+  mutt_mktemp (tempfname, sizeof (tempfname));
   if (!(fpout = safe_fopen (tempfname, "w")))
   {
     mutt_perror (tempfname);
@@ -738,7 +738,7 @@ static void pgp_extract_keys_from_attachment (FILE *fp, BODY *top)
   FILE *tempfp;
   char tempfname[_POSIX_PATH_MAX];
 
-  mutt_mktemp (tempfname);
+  mutt_mktemp (tempfname, sizeof (tempfname));
   if (!(tempfp = safe_fopen (tempfname, "w")))
   {
     mutt_perror (tempfname);
@@ -795,7 +795,7 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout, BODY *p)
   pid_t thepid;
   int rv;
   
-  mutt_mktemp (pgperrfile);
+  mutt_mktemp (pgperrfile, sizeof (pgperrfile));
   if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
   {
     mutt_perror (pgperrfile);
@@ -803,7 +803,7 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout, BODY *p)
   }
   unlink (pgperrfile);
 
-  mutt_mktemp (pgptmpfile);
+  mutt_mktemp (pgptmpfile, sizeof (pgptmpfile));
   if((pgptmp = safe_fopen (pgptmpfile, "w")) == NULL)
   {
     mutt_perror (pgptmpfile);
@@ -911,7 +911,7 @@ int pgp_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
   
   memset (&s, 0, sizeof (s));
   s.fpin = fpin;
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((*fpout = safe_fopen (tempfile, "w+")) == NULL)
   {
     mutt_perror (tempfile);
@@ -953,7 +953,7 @@ int pgp_encrypted_handler (BODY *a, STATE *s)
    */
   a = a->next;
 
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((fpout = safe_fopen (tempfile, "w+")) == NULL)
   {
     if (s->flags & M_DISPLAY)
@@ -1024,13 +1024,13 @@ BODY *pgp_sign_message (BODY *a)
   
   convert_to_7bit (a); /* Signed data _must_ be in 7-bit format. */
 
-  mutt_mktemp (sigfile);
+  mutt_mktemp (sigfile, sizeof (sigfile));
   if ((fp = safe_fopen (sigfile, "w")) == NULL)
   {
     return (NULL);
   }
 
-  mutt_mktemp (signedfile);
+  mutt_mktemp (signedfile, sizeof (signedfile));
   if ((sfp = safe_fopen(signedfile, "w")) == NULL)
   {
     mutt_perror(signedfile);
@@ -1272,14 +1272,14 @@ BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign)
   int empty = 0;
   pid_t thepid;
   
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((fpout = safe_fopen (tempfile, "w+")) == NULL)
   {
     mutt_perror (tempfile);
     return (NULL);
   }
 
-  mutt_mktemp (pgperrfile);
+  mutt_mktemp (pgperrfile, sizeof (pgperrfile));
   if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
   {
     mutt_perror (pgperrfile);
@@ -1289,7 +1289,7 @@ BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign)
   }
   unlink (pgperrfile);
 
-  mutt_mktemp(pgpinfile);
+  mutt_mktemp (pgpinfile, sizeof (pgpinfile));
   if((fptmp = safe_fopen(pgpinfile, "w")) == NULL)
   {
     mutt_perror(pgpinfile);
@@ -1418,7 +1418,7 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist)
     return NULL;
   }
   
-  mutt_mktemp (pgpinfile);
+  mutt_mktemp (pgpinfile, sizeof (pgpinfile));
   if ((pgpin = safe_fopen (pgpinfile, "w")) == NULL)
   {
     mutt_perror (pgpinfile);
@@ -1463,8 +1463,8 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist)
   safe_fclose (&fp);
   safe_fclose (&pgpin);
 
-  mutt_mktemp (pgpoutfile);
-  mutt_mktemp (pgperrfile);
+  mutt_mktemp (pgpoutfile, sizeof (pgpoutfile));
+  mutt_mktemp (pgperrfile, sizeof (pgperrfile));
   if ((pgpout = safe_fopen (pgpoutfile, "w+")) == NULL ||
       (pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
   {
index d837013c0620ab7e7822eb6bd3b3caeeec1c74fb..04bca9f787405d3c01e415d37825a8749af2f5a7 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -547,7 +547,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys,
 
     case OP_VERIFY_KEY:
 
-      mutt_mktemp (tempfile);
+      mutt_mktemp (tempfile, sizeof (tempfile));
       if ((devnull = fopen ("/dev/null", "w")) == NULL)        /* __FOPEN_CHECKED__ */
       {
        mutt_perror _("Can't open /dev/null");
@@ -730,7 +730,7 @@ BODY *pgp_make_key_attachment (char *tempf)
 
   if (!tempf)
   {
-    mutt_mktemp (tempfb);
+    mutt_mktemp (tempfb, sizeof (tempfb));
     tempf = tempfb;
   }
 
index d22c50cc5a1474d5d81a0841c2e67b594c5cad2d..37519825f80e9e54ac5960885f0e76365c81ac16 100644 (file)
@@ -170,7 +170,7 @@ static short pgp_find_hash (const char *fname)
   
   short rv = -1;
   
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((out = safe_fopen (tempfile, "w+")) == NULL)
   {
     mutt_perror (tempfile);
diff --git a/pop.c b/pop.c
index ec1af2329d29ca6eb6d1c2ebc2af004c3766b732..0c98942a812a042073af8328b70a8af66c63b0ac 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -67,7 +67,7 @@ static int pop_read_header (POP_DATA *pop_data, HEADER *h)
   char buf[LONG_STRING];
   char tempfile[_POSIX_PATH_MAX];
 
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if (!(f = safe_fopen (tempfile, "w+")))
   {
     mutt_perror (tempfile);
@@ -568,7 +568,7 @@ int pop_fetch_message (MESSAGE* msg, CONTEXT* ctx, int msgno)
     {
       /* no */
       bcache = 0;
-      mutt_mktemp (path);
+      mutt_mktemp (path, sizeof (path));
       if (!(msg->fp = safe_fopen (path, "w+")))
       {
        mutt_perror (path);
index fb9f3047430547a295ef51ade9ba7ac3dd12a7c1..4606c202ab5d0ccf8b46bbf3840368fb6206b405 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -221,8 +221,8 @@ void mutt_make_misc_reply_headers (ENVELOPE *env, CONTEXT *ctx, HEADER *cur, ENV
 void mutt_make_post_indent (CONTEXT *ctx, HEADER *cur, FILE *out);
 void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra);
 void mutt_message_to_7bit (BODY *, FILE *);
-#define mutt_mktemp(a) _mutt_mktemp (a, __FILE__, __LINE__)
-void _mutt_mktemp (char *, const char *, int);
+#define mutt_mktemp(a,b) _mutt_mktemp (a, b, __FILE__, __LINE__)
+void _mutt_mktemp (char *, size_t, const char *, int);
 void mutt_normalize_time (struct tm *);
 void mutt_paddstr (int, const char *);
 void mutt_parse_mime_message (CONTEXT *ctx, HEADER *);
index e2c4c773c97aab542419e78ec621a20d7896419c..fc75b1bca5f54b7858a184e2fbb640ab2fec65f1 100644 (file)
@@ -584,7 +584,7 @@ mutt_query_pipe_attachment (char *command, FILE *fp, BODY *body, int filter)
       CLEARLINE (LINES-1);
       return;
     }
-    mutt_mktemp (tfile);
+    mutt_mktemp (tfile, sizeof (tfile));
   }
   else
     tfile[0] = 0;
@@ -734,7 +734,7 @@ static void print_attachment_list (FILE *fp, int tag, BODY *top, STATE *state)
          char newfile[_POSIX_PATH_MAX] = "";
          FILE *ifp;
 
-         mutt_mktemp (newfile);
+         mutt_mktemp (newfile, sizeof (newfile));
          if (mutt_decode_save_attachment (fp, top, newfile, M_PRINTING, 0) == 0)
          {
            if ((ifp = fopen (newfile, "r")) != NULL)
index 5f4511f6b7bba8bc67e10feddc03570e3fe4791b..26c39d2b2c795f639ad9299ebe729efd946a2d04 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -435,7 +435,7 @@ static void attach_forward_bodies (FILE * fp, HEADER * hdr,
   tmphdr->env = mutt_new_envelope ();
   mutt_make_forward_subject (tmphdr->env, Context, parent);
 
-  mutt_mktemp (tmpbody);
+  mutt_mktemp (tmpbody, sizeof (tmpbody));
   if ((tmpfp = safe_fopen (tmpbody, "w")) == NULL)
   {
     mutt_error (_("Can't open temporary file %s."), tmpbody);
@@ -613,7 +613,7 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr,
     
     /* no MIME encapsulation */
     
-    mutt_mktemp (tmpbody);
+    mutt_mktemp (tmpbody, sizeof (tmpbody));
     if (!(tmpfp = safe_fopen (tmpbody, "w")))
     {
       mutt_error (_("Can't create %s."), tmpbody);
@@ -863,7 +863,7 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr,
     return;
   }
   
-  mutt_mktemp (tmpbody);
+  mutt_mktemp (tmpbody, sizeof (tmpbody));
   if ((tmpfp = safe_fopen (tmpbody, "w")) == NULL)
   {
     mutt_error (_("Can't create %s."), tmpbody);
index bbe95798bc8a55cc7f2d7f549bdebc1bf8087200..de1683e7bbce30870b652ad2b7f22c0bf6ae6fb6 100644 (file)
--- a/rfc3676.c
+++ b/rfc3676.c
@@ -284,7 +284,7 @@ void rfc3676_space_stuff (HEADER* hdr)
   if ((in = safe_fopen (hdr->content->filename, "r")) == NULL)
     return;
 
-  mutt_mktemp (tmpfile);
+  mutt_mktemp (tmpfile, sizeof (tmpfile));
   if ((out = safe_fopen (tmpfile, "w+")) == NULL)
   {
     safe_fclose (&in);
diff --git a/send.c b/send.c
index c509df176b58755872ad605171c9f2751aac2b5e..511cd8a8a3d7b9ce7ecd2d097a76b2e30f10fb6b 100644 (file)
--- a/send.c
+++ b/send.c
@@ -984,7 +984,7 @@ static int send_message (HEADER *msg)
 #endif
   
   /* Write out the message in MIME form. */
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((tempfp = safe_fopen (tempfile, "w")) == NULL)
     return (-1);
 
@@ -1210,7 +1210,7 @@ ci_send_message (int flags,               /* send mode */
     
     if (!tempfile)
     {
-      mutt_mktemp (buffer);
+      mutt_mktemp (buffer, sizeof (buffer));
       tempfp = safe_fopen (buffer, "w+");
       msg->content->filename = safe_strdup (buffer);
     }
index 73206652b607fbe8aa7a6ba0b7929d484f741b85..a6e7738c34ef975cb6f2730b5f8ec14fe1dce3aa 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1047,7 +1047,7 @@ void mutt_message_to_7bit (BODY *a, FILE *fp)
     a->length = sb.st_size;
   }
 
-  mutt_mktemp (temp);
+  mutt_mktemp (temp, sizeof (temp));
   if (!(fpout = safe_fopen (temp, "w+")))
   {
     mutt_perror ("fopen");
@@ -1118,7 +1118,7 @@ static void transform_to_7bit (BODY *a, FILE *fpin)
       a->noconv = 1;
       a->force_charset = 1;
 
-      mutt_mktemp (buff);
+      mutt_mktemp (buff, sizeof (buff));
       if ((s.fpout = safe_fopen (buff, "w")) == NULL)
       {
        mutt_perror ("fopen");
@@ -1261,7 +1261,7 @@ BODY *mutt_make_message_attach (CONTEXT *ctx, HEADER *hdr, int attach_msg)
     }
   }
 
-  mutt_mktemp (buffer);
+  mutt_mktemp (buffer, sizeof (buffer));
   if ((fp = safe_fopen (buffer, "w+")) == NULL)
     return NULL;
 
@@ -2097,7 +2097,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile)
   {
     char tmp[_POSIX_PATH_MAX];
 
-    mutt_mktemp (tmp);
+    mutt_mktemp (tmp, sizeof (tmp));
     *tempfile = safe_strdup (tmp);
   }
 
@@ -2453,7 +2453,7 @@ static int _mutt_bounce_message (FILE *fp, HEADER *h, ADDRESS *to, const char *r
 
   if (!fp) fp = msg->fp;
 
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((f = safe_fopen (tempfile, "w")) != NULL)
   {
     int ch_flags = CH_XMIT | CH_NONEWLINE | CH_NOQFROM;
@@ -2615,7 +2615,7 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post,
    */
   if (f.magic == M_MMDF || f.magic == M_MBOX)
   {
-    mutt_mktemp (tempfile);
+    mutt_mktemp (tempfile, sizeof (tempfile));
     if ((tempfp = safe_fopen (tempfile, "w+")) == NULL)
     {
       mutt_perror (tempfile);
diff --git a/smime.c b/smime.c
index e4a784fbcbc953612e3b54cb363380c11ab0d799..2068fcfe3cfbdf3ec9d460ac6e515672a7659f88 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -825,7 +825,7 @@ static int smime_handle_cert_email (char *certificate, char *mailbox,
   int ret = -1, count = 0;
   pid_t thepid;
 
-  mutt_mktemp (tmpfname);
+  mutt_mktemp (tmpfname, sizeof (tmpfname));
   if ((fperr = safe_fopen (tmpfname, "w+")) == NULL)
   {
     mutt_perror (tmpfname);
@@ -833,7 +833,7 @@ static int smime_handle_cert_email (char *certificate, char *mailbox,
   }
   mutt_unlink (tmpfname);
 
-  mutt_mktemp (tmpfname);
+  mutt_mktemp (tmpfname, sizeof (tmpfname));
   if ((fpout = safe_fopen (tmpfname, "w+")) == NULL)
   {
     safe_fclose (&fperr);
@@ -916,7 +916,7 @@ static char *smime_extract_certificate (char *infile)
   int empty;
 
 
-  mutt_mktemp (tmpfname);
+  mutt_mktemp (tmpfname, sizeof (tmpfname));
   if ((fperr = safe_fopen (tmpfname, "w+")) == NULL)
   {
     mutt_perror (tmpfname);
@@ -924,7 +924,7 @@ static char *smime_extract_certificate (char *infile)
   }
   mutt_unlink (tmpfname);
 
-  mutt_mktemp (pk7out);
+  mutt_mktemp (pk7out, sizeof (pk7out));
   if ((fpout = safe_fopen (pk7out, "w+")) == NULL)
   {
     safe_fclose (&fperr);
@@ -968,7 +968,7 @@ static char *smime_extract_certificate (char *infile)
 
 
   safe_fclose (&fpout);
-  mutt_mktemp (certfile);
+  mutt_mktemp (certfile, sizeof (certfile));
   if ((fpout = safe_fopen (certfile, "w+")) == NULL)
   {
     safe_fclose (&fperr);
@@ -1025,7 +1025,7 @@ static char *smime_extract_signer_certificate (char *infile)
   int empty;
 
 
-  mutt_mktemp (tmpfname);
+  mutt_mktemp (tmpfname, sizeof (tmpfname));
   if ((fperr = safe_fopen (tmpfname, "w+")) == NULL)
   {
     mutt_perror (tmpfname);
@@ -1034,7 +1034,7 @@ static char *smime_extract_signer_certificate (char *infile)
   mutt_unlink (tmpfname);
 
 
-  mutt_mktemp (certfile);
+  mutt_mktemp (certfile, sizeof (certfile));
   if ((fpout = safe_fopen (certfile, "w+")) == NULL)
   {
     safe_fclose (&fperr);
@@ -1092,7 +1092,7 @@ void smime_invoke_import (char *infile, char *mailbox)
   FILE *smimein=NULL, *fpout = NULL, *fperr = NULL;
   pid_t thepid=-1;
 
-  mutt_mktemp (tmpfname);
+  mutt_mktemp (tmpfname, sizeof (tmpfname));
   if ((fperr = safe_fopen (tmpfname, "w+")) == NULL)
   {
     mutt_perror (tmpfname);
@@ -1100,7 +1100,7 @@ void smime_invoke_import (char *infile, char *mailbox)
   }
   mutt_unlink (tmpfname);
 
-  mutt_mktemp (tmpfname);
+  mutt_mktemp (tmpfname, sizeof (tmpfname));
   if ((fpout = safe_fopen (tmpfname, "w+")) == NULL)
   {
     safe_fclose (&fperr);
@@ -1158,7 +1158,7 @@ int smime_verify_sender(HEADER *h)
   FILE *fpout;
   int retval=1;
 
-  mutt_mktemp (tempfname);
+  mutt_mktemp (tempfname, sizeof (tempfname));
   if (!(fpout = safe_fopen (tempfname, "w")))
   {
     mutt_perror (tempfname);
@@ -1263,14 +1263,14 @@ BODY *smime_build_smime_entity (BODY *a, char *certlist)
   int err = 0, empty;
   pid_t thepid;
   
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((fpout = safe_fopen (tempfile, "w+")) == NULL)
   {
     mutt_perror (tempfile);
     return (NULL);
   }
 
-  mutt_mktemp (smimeerrfile);
+  mutt_mktemp (smimeerrfile, sizeof (smimeerrfile));
   if ((smimeerr = safe_fopen (smimeerrfile, "w+")) == NULL)
   {
     mutt_perror (smimeerrfile);
@@ -1280,7 +1280,7 @@ BODY *smime_build_smime_entity (BODY *a, char *certlist)
   }
   mutt_unlink (smimeerrfile);
   
-  mutt_mktemp (smimeinfile);
+  mutt_mktemp (smimeinfile, sizeof (smimeinfile));
   if ((fptmp = safe_fopen (smimeinfile, "w+")) == NULL)
   {
     mutt_perror (smimeinfile);
@@ -1399,7 +1399,7 @@ BODY *smime_sign_message (BODY *a )
 
   convert_to_7bit (a); /* Signed data _must_ be in 7-bit format. */
 
-  mutt_mktemp (filetosign);
+  mutt_mktemp (filetosign, sizeof (filetosign));
   if ((sfp = safe_fopen (filetosign, "w+")) == NULL)
   {
     mutt_perror (filetosign);
@@ -1408,7 +1408,7 @@ BODY *smime_sign_message (BODY *a )
     return NULL;
   }
 
-  mutt_mktemp (signedfile);
+  mutt_mktemp (signedfile, sizeof (signedfile));
   if ((smimeout = safe_fopen (signedfile, "w+")) == NULL)
   {
     mutt_perror (signedfile);
@@ -1604,7 +1604,7 @@ int smime_verify_one (BODY *sigbdy, STATE *s, const char *tempfile)
   sigbdy->type = origType;
 
   
-  mutt_mktemp (smimeerrfile);
+  mutt_mktemp (smimeerrfile, sizeof (smimeerrfile));
   if (!(smimeerr = safe_fopen (smimeerrfile, "w+")))
   {
     mutt_perror (smimeerrfile);
@@ -1688,14 +1688,14 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile)
 
   if (!(type & APPLICATION_SMIME)) return NULL;
 
-  mutt_mktemp (outfile);
+  mutt_mktemp (outfile, sizeof (outfile));
   if ((smimeout = safe_fopen (outfile, "w+")) == NULL)
   {
     mutt_perror (outfile);
     return NULL;
   }
   
-  mutt_mktemp (errfile);
+  mutt_mktemp (errfile, sizeof (errfile));
   if ((smimeerr = safe_fopen (errfile, "w+")) == NULL)
   {
     mutt_perror (errfile);
@@ -1705,7 +1705,7 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile)
   mutt_unlink (errfile);
 
   
-  mutt_mktemp (tmpfname);
+  mutt_mktemp (tmpfname, sizeof (tmpfname));
   if ((tmpfp = safe_fopen (tmpfname, "w+")) == NULL)
   {
     mutt_perror (tmpfname);
@@ -1788,7 +1788,7 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile)
     if (outFile) fpout = outFile;
     else
     {
-      mutt_mktemp (tmptmpfname);
+      mutt_mktemp (tmptmpfname, sizeof (tmptmpfname));
       if ((fpout = safe_fopen (tmptmpfname, "w+")) == NULL)
       {
        mutt_perror(tmptmpfname);
@@ -1895,7 +1895,7 @@ int smime_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
   s.fpin = fpin;
   fseeko (s.fpin, b->offset, 0);
 
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((tmpfp = safe_fopen (tempfile, "w+")) == NULL)
   {
     mutt_perror (tempfile);
@@ -1912,7 +1912,7 @@ int smime_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
   s.fpin = tmpfp;
   s.fpout = 0;
 
-  mutt_mktemp (tempfile);
+  mutt_mktemp (tempfile, sizeof (tempfile));
   if ((*fpout = safe_fopen (tempfile, "w+")) == NULL)
   {
     mutt_perror (tempfile);