diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1999-02-10 21:42:05 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1999-02-10 21:42:05 +0000 |
commit | 40aab0a8b99e842d3f9f0928f3fdb7305a944893 (patch) | |
tree | fdac5b82780363d71e437fbc5cca0db61db8caf6 /rfc1524.c | |
parent | 15739ddd2345d227a16d18a3abfb740ae7c2ec0f (diff) |
[unstable] $mailcap_sanitize.
Diffstat (limited to 'rfc1524.c')
-rw-r--r-- | rfc1524.c | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -48,13 +48,24 @@ * In addition, this function returns a 0 if the command works on a file, * and 1 if the command works on a pipe. */ -int rfc1524_expand_command (BODY *a, char *filename, char *type, +int rfc1524_expand_command (BODY *a, char *_filename, char *_type, char *command, int clen) { int x=0,y=0; int needspipe = TRUE; char buf[LONG_STRING]; - + char filename[_POSIX_PATH_MAX]; + char type[LONG_STRING]; + + strfcpy (filename, _filename, sizeof (filename)); + strfcpy (type, _type, sizeof (type)); + + if (option (OPTMAILCAPSANITIZE)) + { + mutt_sanitize_filename (filename); + mutt_sanitize_filename (type); + } + while (command[x] && x<clen && y<sizeof(buf)) { if (command[x] == '\\') { @@ -67,13 +78,21 @@ int rfc1524_expand_command (BODY *a, char *filename, char *type, if (command[x] == '{') { char param[STRING]; + char pvalue[STRING]; + char *_pvalue; int z = 0; x++; while (command[x] && command[x] != '}' && z<sizeof(param)) param[z++] = command[x++]; param[z] = '\0'; - y += mutt_quote_filename (buf + y, sizeof (buf) - y, mutt_get_parameter(param,a->parameter)); + + _pvalue = mutt_get_parameter (param, a->parameter); + strfcpy (pvalue, NONULL(_pvalue), sizeof (pvalue)); + if (option (OPTMAILCAPSANITIZE)) + mutt_sanitize_filename (pvalue); + + y += mutt_quote_filename (buf + y, sizeof (buf) - y, pvalue); } else if (command[x] == 's' && filename != NULL) { @@ -82,8 +101,7 @@ int rfc1524_expand_command (BODY *a, char *filename, char *type, } else if (command[x] == 't') { - while (*type && y < sizeof (buf)) - buf[y++] = *type++; + y += mutt_quote_filename (buf + y, sizeof (buf) - y, type); } x++; } |