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

« back to all changes in this revision

Viewing changes to complete.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:
79
79
    if ((p = strrchr (s, '/')))
80
80
    {
81
81
      char buf[_POSIX_PATH_MAX];
82
 
      *p++ = 0;
83
 
      mutt_concat_path (buf, exp_dirpart, s + 1, sizeof (buf));
 
82
      if (mutt_concatn_path (buf, sizeof(buf), exp_dirpart, strlen(exp_dirpart), s + 1, (size_t)(p - s - 1)) == NULL) {
 
83
              return -1;
 
84
      }
84
85
      strfcpy (exp_dirpart, buf, sizeof (exp_dirpart));
85
 
      snprintf (buf, sizeof (buf), "%s%s/", dirpart, s+1);
86
 
      strfcpy (dirpart, buf, sizeof (dirpart));
87
 
      strfcpy (filepart, p, sizeof (filepart));
 
86
      mutt_substrcpy(dirpart, s, p+1, sizeof(dirpart));
 
87
      strfcpy (filepart, p + 1, sizeof (filepart));
88
88
    }
89
89
    else
90
90
      strfcpy (filepart, s + 1, sizeof (filepart));
104
104
      }
105
105
      else
106
106
      {
107
 
        *p = 0;
108
 
        len = (size_t)(p - s);
109
 
        strncpy (dirpart, s, len);
110
 
        dirpart[len]=0;
111
 
        p++;
112
 
        strfcpy (filepart, p, sizeof (filepart));
 
107
        mutt_substrcpy(dirpart, s, p, sizeof(dirpart));
 
108
        strfcpy (filepart, p + 1, sizeof (filepart));
113
109
        strfcpy (exp_dirpart, dirpart, sizeof (exp_dirpart));
114
110
        mutt_expand_path (exp_dirpart, sizeof (exp_dirpart));
115
111
        dirp = opendir (exp_dirpart);