]> diplodocus.org Git - nmh/commitdiff
Wrapped uses of %{charset} in mhn.defaults with double quotes.
authorDavid Levine <levinedl@acm.org>
Thu, 18 Jan 2018 00:36:12 +0000 (19:36 -0500)
committerDavid Levine <levinedl@acm.org>
Thu, 18 Jan 2018 00:36:12 +0000 (19:36 -0500)
NEWS
etc/mhn.defaults.sh
man/mhshow.man
test/mhshow/test-textcharset

diff --git a/NEWS b/NEWS
index b459887..ef15c71 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -129,6 +129,7 @@ BUG FIXES
 - An error when writing an error message, e.g. EPIPE, no longer causes
   recursion until the stack is exhausted.
 - rcvdist(1) now passes switch arguments to post(8).
+- The uses of %{charset} in mhn.defaults were wrapped with double quotes.
 
 -------------------
 DEPRECATED FEATURES
index 0253f28..5566f21 100755 (executable)
@@ -131,7 +131,7 @@ fi
 ####
 cat <<EOF >>${TMP}
 mhbuild-convert-text/calendar: mhical -infile %F -contenttype
-mhbuild-convert-text: charset=%{charset}; iconv -f \${charset:-us-ascii} -t utf-8 %F${replfmt}
+mhbuild-convert-text: charset="%{charset}"; iconv -f "\${charset:-us-ascii}" -t utf-8 %F${replfmt}
 mhbuild-disposition-text/calendar: inline
 mhbuild-disposition-message/rfc822: inline
 EOF
@@ -287,24 +287,24 @@ EOF
 # that another netscape is already running and certain things can't be done).
 PGM=`$SEARCHPROG "$SEARCHPATH" w3m`
 if [ ! -z "$PGM" ]; then
-    echo 'mhshow-show-text/html: charset=%{charset}; '"\
+    echo 'mhshow-show-text/html: charset="%{charset}"; '"\
 %l$PGM"' -dump ${charset:+-I} ${charset:+"$charset"} -T text/html %F' >> $TMP
-    echo 'mhfixmsg-format-text/html: charset=%{charset}; '"\
+    echo 'mhfixmsg-format-text/html: charset="%{charset}"; '"\
 $PGM "'-dump ${charset:+-I} ${charset:+"$charset"} -O utf-8 -T text/html %F' \
          >> $TMP
-    echo 'mhbuild-convert-text/html: charset=%{charset}; '"\
+    echo 'mhbuild-convert-text/html: charset="%{charset}"; '"\
 $PGM "'-dump ${charset:+-I} ${charset:+"$charset"} -O utf-8 -T text/html %F '"\
 ${replfmt}" >> $TMP
 else
     PGM=`$SEARCHPROG "$SEARCHPATH" lynx`
     if [ ! -z "$PGM" ]; then
-       echo 'mhshow-show-text/html: charset=%{charset}; '"\
+       echo 'mhshow-show-text/html: charset="%{charset}"; '"\
 %l$PGM"' -child -dump -force-html ${charset:+--assume_charset} ${charset:+"$charset"} %F' >> $TMP
         #### lynx indents with 3 spaces, remove them and any trailing spaces.
-        echo 'mhfixmsg-format-text/html: charset=%{charset}; '"\
+        echo 'mhfixmsg-format-text/html: charset="%{charset}"; '"\
 $PGM "'-child -dump -force_html ${charset:+--assume_charset} ${charset:+"$charset"} %F | '"\
 expand | sed -e 's/^   //' -e 's/  *$//'" >> $TMP
-        echo 'mhbuild-convert-text/html: charset=%{charset}; '"\
+        echo 'mhbuild-convert-text/html: charset="%{charset}"; '"\
 $PGM "'-child -dump -force_html ${charset:+--assume_charset} ${charset:+"$charset"} '"\
 %F${replfmt}" >> $TMP
     else
index 935e1d1..4cbbd19 100644 (file)
@@ -360,14 +360,14 @@ for the current display string to finish execution before executing
 the next display string.
 .PP
 The {parameter} escape is typically used in a command line argument
-that should only be present if it has a non-null value.  Its value
-will be wrapped with single quotes if the escape is not so wrapped.
+that should only be present if it has a non-null value.  It is highly
+recommended that the entire escape be wrapped in double quotes.
 Shell parameter expansion can construct the argument only when it is
 non-null, e.g.,
 .PP
 .RS 5
 .nf
-mhshow-show-text/html: charset=%{charset};
+mhshow-show-text/html: charset="%{charset}";
   w3m ${charset:+-I $charset} -T text/html %F
 .fi
 .RE
index 8bba169..78500a5 100755 (executable)
@@ -305,6 +305,23 @@ EOF
 run_prog mhshow last >"$actual" 2>&1
 check "$expected" "$actual" : parameter value quoting with text following
 
+# check malicious parameter value quoting
+msgfile=`mhpath new`
+msgnum=`basename $msgfile`
+cat >"$msgfile" <<'EOF'
+Subject: shows difficulty of quoting with /bin/sh -c
+MIME-Version: 1.0
+Content-Type: text/html; charset="oops'; echo should not see this!"
+
+EOF
+
+cat >"$expected" <<EOF
+[ part  - text/html -   0B  ]
+EOF
+
+run_prog mhshow -noheader -form mhl.null last >"$actual" 2>&1
+check "$expected" "$actual" : malicious parameter value quoting
+
 #
 # test a large file that needs to be converted to UTF-8
 #