/* 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.");
mutt_adv_mktemp (pagerfile, sizeof(pagerfile));
}
else
- mutt_mktemp (pagerfile);
+ mutt_mktemp (pagerfile, sizeof (pagerfile));
}
if (use_mailcap)
ifp = NULL;
fpout = NULL;
- mutt_mktemp (newfile);
+ mutt_mktemp (newfile, sizeof (newfile));
if (mutt_decode_save_attachment (fp, a, newfile, M_PRINTING, 0) == 0)
{
}
- mutt_mktemp (tempfile);
+ mutt_mktemp (tempfile, sizeof (tempfile));
if ((fpout = safe_fopen (tempfile, "w")) == NULL)
{
mutt_error _("Could not create temporary file!");
if (!WithCrypto)
return;
- mutt_mktemp (tempfname);
+ mutt_mktemp (tempfname, sizeof (tempfname));
if (!(fpout = safe_fopen (tempfname, "w")))
{
mutt_perror (tempfname);
if (sigcnt)
{
- mutt_mktemp (tempfile);
+ mutt_mktemp (tempfile, sizeof (tempfile));
if (crypt_write_signed (a, s, tempfile) == 0)
{
for (i = 0; i < sigcnt; i++)
struct stat sb;
time_t mtime = 0;
- mutt_mktemp (tmp);
+ mutt_mktemp (tmp, sizeof (tmp));
omagic = DefaultMagic;
DefaultMagic = M_MBOX;
{
/* 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!");
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);
FILE *f;
struct binding_t *funcs;
- mutt_mktemp (t);
+ mutt_mktemp (t, sizeof (t));
funcs = km_get_table (menu);
desc = mutt_getnamebyvalue (menu, Menus);
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;
/* 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);
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+")))
{
else
fin = NULL;
- mutt_mktemp (buf);
+ mutt_mktemp (buf, sizeof (buf));
tempfile = safe_strdup (buf);
if (draftFile)
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)
{
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);
}
{
char tmp[_POSIX_PATH_MAX];
- mutt_mktemp(tmp);
+ mutt_mktemp (tmp, sizeof (tmp));
if ((msg->fp = safe_fopen (tmp, "w")) == NULL)
{
mutt_perror (tmp);
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);
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);
/* 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);
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);
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);
return;
}
- mutt_mktemp (tempfname);
+ mutt_mktemp (tempfname, sizeof (tempfname));
if (!(fpout = safe_fopen (tempfname, "w")))
{
mutt_perror (tempfname);
FILE *tempfp;
char tempfname[_POSIX_PATH_MAX];
- mutt_mktemp (tempfname);
+ mutt_mktemp (tempfname, sizeof (tempfname));
if (!(tempfp = safe_fopen (tempfname, "w")))
{
mutt_perror (tempfname);
pid_t thepid;
int rv;
- mutt_mktemp (pgperrfile);
+ mutt_mktemp (pgperrfile, sizeof (pgperrfile));
if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
{
mutt_perror (pgperrfile);
}
unlink (pgperrfile);
- mutt_mktemp (pgptmpfile);
+ mutt_mktemp (pgptmpfile, sizeof (pgptmpfile));
if((pgptmp = safe_fopen (pgptmpfile, "w")) == NULL)
{
mutt_perror (pgptmpfile);
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);
*/
a = a->next;
- mutt_mktemp (tempfile);
+ mutt_mktemp (tempfile, sizeof (tempfile));
if ((fpout = safe_fopen (tempfile, "w+")) == NULL)
{
if (s->flags & M_DISPLAY)
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);
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);
}
unlink (pgperrfile);
- mutt_mktemp(pgpinfile);
+ mutt_mktemp (pgpinfile, sizeof (pgpinfile));
if((fptmp = safe_fopen(pgpinfile, "w")) == NULL)
{
mutt_perror(pgpinfile);
return NULL;
}
- mutt_mktemp (pgpinfile);
+ mutt_mktemp (pgpinfile, sizeof (pgpinfile));
if ((pgpin = safe_fopen (pgpinfile, "w")) == NULL)
{
mutt_perror (pgpinfile);
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)
{
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");
if (!tempf)
{
- mutt_mktemp (tempfb);
+ mutt_mktemp (tempfb, sizeof (tempfb));
tempf = tempfb;
}
short rv = -1;
- mutt_mktemp (tempfile);
+ mutt_mktemp (tempfile, sizeof (tempfile));
if ((out = safe_fopen (tempfile, "w+")) == NULL)
{
mutt_perror (tempfile);
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);
{
/* no */
bcache = 0;
- mutt_mktemp (path);
+ mutt_mktemp (path, sizeof (path));
if (!(msg->fp = safe_fopen (path, "w+")))
{
mutt_perror (path);
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 *);
CLEARLINE (LINES-1);
return;
}
- mutt_mktemp (tfile);
+ mutt_mktemp (tfile, sizeof (tfile));
}
else
tfile[0] = 0;
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)
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);
/* no MIME encapsulation */
- mutt_mktemp (tmpbody);
+ mutt_mktemp (tmpbody, sizeof (tmpbody));
if (!(tmpfp = safe_fopen (tmpbody, "w")))
{
mutt_error (_("Can't create %s."), tmpbody);
return;
}
- mutt_mktemp (tmpbody);
+ mutt_mktemp (tmpbody, sizeof (tmpbody));
if ((tmpfp = safe_fopen (tmpbody, "w")) == NULL)
{
mutt_error (_("Can't create %s."), tmpbody);
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);
#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);
if (!tempfile)
{
- mutt_mktemp (buffer);
+ mutt_mktemp (buffer, sizeof (buffer));
tempfp = safe_fopen (buffer, "w+");
msg->content->filename = safe_strdup (buffer);
}
a->length = sb.st_size;
}
- mutt_mktemp (temp);
+ mutt_mktemp (temp, sizeof (temp));
if (!(fpout = safe_fopen (temp, "w+")))
{
mutt_perror ("fopen");
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");
}
}
- mutt_mktemp (buffer);
+ mutt_mktemp (buffer, sizeof (buffer));
if ((fp = safe_fopen (buffer, "w+")) == NULL)
return NULL;
{
char tmp[_POSIX_PATH_MAX];
- mutt_mktemp (tmp);
+ mutt_mktemp (tmp, sizeof (tmp));
*tempfile = safe_strdup (tmp);
}
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;
*/
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);
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);
}
mutt_unlink (tmpfname);
- mutt_mktemp (tmpfname);
+ mutt_mktemp (tmpfname, sizeof (tmpfname));
if ((fpout = safe_fopen (tmpfname, "w+")) == NULL)
{
safe_fclose (&fperr);
int empty;
- mutt_mktemp (tmpfname);
+ mutt_mktemp (tmpfname, sizeof (tmpfname));
if ((fperr = safe_fopen (tmpfname, "w+")) == NULL)
{
mutt_perror (tmpfname);
}
mutt_unlink (tmpfname);
- mutt_mktemp (pk7out);
+ mutt_mktemp (pk7out, sizeof (pk7out));
if ((fpout = safe_fopen (pk7out, "w+")) == NULL)
{
safe_fclose (&fperr);
safe_fclose (&fpout);
- mutt_mktemp (certfile);
+ mutt_mktemp (certfile, sizeof (certfile));
if ((fpout = safe_fopen (certfile, "w+")) == NULL)
{
safe_fclose (&fperr);
int empty;
- mutt_mktemp (tmpfname);
+ mutt_mktemp (tmpfname, sizeof (tmpfname));
if ((fperr = safe_fopen (tmpfname, "w+")) == NULL)
{
mutt_perror (tmpfname);
mutt_unlink (tmpfname);
- mutt_mktemp (certfile);
+ mutt_mktemp (certfile, sizeof (certfile));
if ((fpout = safe_fopen (certfile, "w+")) == NULL)
{
safe_fclose (&fperr);
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);
}
mutt_unlink (tmpfname);
- mutt_mktemp (tmpfname);
+ mutt_mktemp (tmpfname, sizeof (tmpfname));
if ((fpout = safe_fopen (tmpfname, "w+")) == NULL)
{
safe_fclose (&fperr);
FILE *fpout;
int retval=1;
- mutt_mktemp (tempfname);
+ mutt_mktemp (tempfname, sizeof (tempfname));
if (!(fpout = safe_fopen (tempfname, "w")))
{
mutt_perror (tempfname);
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);
}
mutt_unlink (smimeerrfile);
- mutt_mktemp (smimeinfile);
+ mutt_mktemp (smimeinfile, sizeof (smimeinfile));
if ((fptmp = safe_fopen (smimeinfile, "w+")) == NULL)
{
mutt_perror (smimeinfile);
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);
return NULL;
}
- mutt_mktemp (signedfile);
+ mutt_mktemp (signedfile, sizeof (signedfile));
if ((smimeout = safe_fopen (signedfile, "w+")) == NULL)
{
mutt_perror (signedfile);
sigbdy->type = origType;
- mutt_mktemp (smimeerrfile);
+ mutt_mktemp (smimeerrfile, sizeof (smimeerrfile));
if (!(smimeerr = safe_fopen (smimeerrfile, "w+")))
{
mutt_perror (smimeerrfile);
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);
mutt_unlink (errfile);
- mutt_mktemp (tmpfname);
+ mutt_mktemp (tmpfname, sizeof (tmpfname));
if ((tmpfp = safe_fopen (tmpfname, "w+")) == NULL)
{
mutt_perror (tmpfname);
if (outFile) fpout = outFile;
else
{
- mutt_mktemp (tmptmpfname);
+ mutt_mktemp (tmptmpfname, sizeof (tmptmpfname));
if ((fpout = safe_fopen (tmptmpfname, "w+")) == NULL)
{
mutt_perror(tmptmpfname);
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);
s.fpin = tmpfp;
s.fpout = 0;
- mutt_mktemp (tempfile);
+ mutt_mktemp (tempfile, sizeof (tempfile));
if ((*fpout = safe_fopen (tempfile, "w+")) == NULL)
{
mutt_perror (tempfile);