#include "mutt_crypt.h"
#include "mutt_curses.h"
+#include "group.h"
#ifdef USE_IMAP
#include "mx.h"
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);
static int eat_regexp (pattern_t *pat, BUFFER *s, BUFFER *err)
{
BUFFER buf;
+ char errmsg[STRING];
int r;
memset (&buf, 0, sizeof (buf));
{
pat->p.rx = safe_malloc (sizeof (regex_t));
r = REGCOMP (pat->p.rx, buf.data, REG_NEWLINE | REG_NOSUB | mutt_which_case (buf.data));
- FREE (&buf.data);
if (r)
{
- regerror (r, pat->p.rx, err->data, err->dsize);
- regfree (pat->p.rx);
+ regerror (r, pat->p.rx, errmsg, sizeof (errmsg));
+ mutt_buffer_printf (err, "'%s': %s", buf.data, errmsg);
+ FREE (&buf.data);
FREE (&pat->p.rx);
return (-1);
}
+ FREE (&buf.data);
}
return 0;
case '%':
case '=':
case '~':
- if (*(ps.dptr + 1) == '(')
+ if (!*(ps.dptr + 1))
+ {
+ snprintf (err->data, err->dsize, _("missing pattern: %s"), ps.dptr);
+ mutt_pattern_free (&curlist);
+ return NULL;
+ }
+ if (*(ps.dptr + 1) == '(')
{
ps.dptr ++; /* skip ~ */
p = find_matching_paren (ps.dptr + 1);
simple = safe_strdup (buf);
mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch));
+ memset (&err, 0, sizeof(err));
err.data = error;
err.dsize = sizeof (error);
if ((pat = mutt_pattern_comp (buf, M_FULL_MSG, &err)) == NULL)
char buf[STRING];
char temp[LONG_STRING];
char error[STRING];
- BUFFER err;
int incr;
HEADER *h;
progress_t progress;
mutt_check_simple (temp, sizeof (temp), NONULL (SimpleSearch));
if (!SearchPattern || mutt_strcmp (temp, LastSearchExpn))
- {
+ {
+ BUFFER err;
+ memset(&err, 0, sizeof(err));
set_option (OPTSEARCHINVALID);
strfcpy (LastSearch, buf, sizeof (LastSearch));
mutt_message _("Compiling search pattern...");
err.data = error;
err.dsize = sizeof (error);
if ((SearchPattern = mutt_pattern_comp (temp, M_FULL_MSG, &err)) == NULL)
- {
+ {
mutt_error ("%s", error);
+ LastSearch[0] = '\0';
return (-1);
}
mutt_clear_error ();