Changeset 1374:50299dadf2e0 for alias.c

Show
Ignore:
Timestamp:
1999-11-17 12:22:33 (9 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Fix the address sanitizer. You should now be able to auto-create an
alias for someone like "Jon K. Hellan" <hellan@…>.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • alias.c

    r1283 r1374  
    129129} 
    130130 
    131 /* if someone has an address like 
     131/*  
     132 * if someone has an address like 
    132133 *      From: Michael `/bin/rm -f ~` Elkins <me@cs.hmc.edu> 
    133134 * and the user creates an alias for this, Mutt could wind up executing 
     
    141142 *      alias me Michael \\`/bin/rm -f ~\\` Elkins <me@cs.hmc.edu> 
    142143 * which still gets evaluated because the double backslash is not a quote. 
     144 *  
     145 * Additionally, we need to quote ' and " characters - otherwise, mutt will 
     146 * interpret them on the wrong parsing step. 
     147 *  
     148 * $ wants to be quoted since it may indicate the start of an environment 
     149 * variable. 
    143150 */ 
     151 
    144152static void write_safe_address (FILE *fp, char *s) 
    145153{ 
    146154  while (*s) 
    147155  { 
    148     if (*s == '\\' || *s == '`') 
     156    if (*s == '\\' || *s == '`' || *s == '\'' || *s == '"' 
     157        || *s == '$') 
    149158      fputc ('\\', fp); 
    150159    fputc (*s, fp);