~ubuntu-branches/ubuntu/vivid/mutt/vivid-updates

« back to all changes in this revision

Viewing changes to hook.c

Tags: 1.5.18-6
* Grab from upstream:
  + Guard idata->mailbox read in imap_mailbox_state.
    The bug happens when a user has more than a imap mailbox, when
    he/she browses through them mutt will segfault.
    (Closes: #462266, #513230, #514309. Mutt: #3057)

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
    memset (&pattern, 0, sizeof (pattern));
93
93
    pattern.data = safe_strdup (path);
94
94
  }
95
 
  else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ACCOUNTHOOK))
 
95
  else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ICONVHOOK | M_ACCOUNTHOOK))
96
96
           && (!WithCrypto || !(data & M_CRYPTHOOK))
97
97
      )
98
98
  {
99
99
    char tmp[HUGE_STRING];
100
100
 
 
101
    /* At this stage remain only message-hooks, reply-hooks, send-hooks,
 
102
     * send2-hooks, save-hooks, and fcc-hooks: All those allowing full
 
103
     * patterns. If given a simple regexp, we expand $default_hook.
 
104
     */
101
105
    strfcpy (tmp, pattern.data, sizeof (tmp));
102
106
    mutt_check_simple (tmp, sizeof (tmp), DefaultHook);
103
107
    FREE (&pattern.data);
153
157
  if (data & (M_SENDHOOK | M_SEND2HOOK | M_SAVEHOOK | M_FCCHOOK | M_MESSAGEHOOK | M_REPLYHOOK))
154
158
  {
155
159
    if ((pat = mutt_pattern_comp (pattern.data,
156
 
           (data & (M_SENDHOOK | M_SEND2HOOK | M_FCCHOOK | M_REPLYHOOK)) ? 0 : M_FULL_MSG,
 
160
           (data & (M_SENDHOOK | M_SEND2HOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG,
157
161
                                  err)) == NULL)
158
162
      goto error;
159
163
  }
160
164
  else
161
165
  {
 
166
    /* Hooks not allowing full patterns: Check syntax of regexp */
162
167
    rx = safe_malloc (sizeof (regex_t));
163
168
#ifdef M_CRYPTHOOK
164
 
    if ((rc = REGCOMP (rx, NONULL(pattern.data), ((data & (M_CRYPTHOOK|M_CHARSETHOOK)) ? REG_ICASE : 0))) != 0)
 
169
    if ((rc = REGCOMP (rx, NONULL(pattern.data), ((data & (M_CRYPTHOOK|M_CHARSETHOOK|M_ICONVHOOK)) ? REG_ICASE : 0))) != 0)
165
170
#else
166
171
    if ((rc = REGCOMP (rx, NONULL(pattern.data), (data & (M_CHARSETHOOK|M_ICONVHOOK)) ? REG_ICASE : 0)) != 0)
167
172
#endif /* M_CRYPTHOOK */