Show
Ignore:
Timestamp:
2007-04-07 14:33:27 (20 months ago)
Author:
Michael Elkins <me@…>
Branch:
HEAD
Message:

bug #2871

Avoid altering the argument to mutt_complete() when completion fails. Previously, the trailing component of filename was removed each time the user pressed TAB.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • complete.c

    r4343 r5092  
    8080    { 
    8181      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      } 
    8485      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)); 
    8888    } 
    8989    else 
     
    105105      else 
    106106      { 
    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)); 
    113109        strfcpy (exp_dirpart, dirpart, sizeof (exp_dirpart)); 
    114110        mutt_expand_path (exp_dirpart, sizeof (exp_dirpart));