summaryrefslogtreecommitdiff
path: root/program/steps/mail/sendmail.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-11-02 22:43:55 +0000
committerthomascube <thomas@roundcube.net>2005-11-02 22:43:55 +0000
commit6a35c82a3ca43546198361aefdea94b04ecb5457 (patch)
tree9a23bce5d1a7dc9fa0bfc1c93cbbe7b145b4fca0 /program/steps/mail/sendmail.inc
parentfd660ac0e2af4fc3c2633cfd19bd31fd7a905951 (diff)
Added more XSS protection (Bug #1308236) and some visual enhancements
Diffstat (limited to 'program/steps/mail/sendmail.inc')
-rw-r--r--program/steps/mail/sendmail.inc11
1 files changed, 6 insertions, 5 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index fbb31b3d8..48a5ccc6f 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -65,10 +65,11 @@ function rcmail_get_identity($id)
/****** check submission and compose message ********/
-$mailto_regexp = '/,\s*$/';
+$mailto_regexp = array('/,\s*[\r\n]+/', '/[\r\n]+/', '/,\s*$/m');
+$mailto_replace = array(' ', ', ', '');
-// trip ending ', ' from
-$mailto = preg_replace($mailto_regexp, '', $_POST['_to']);
+// repalce new lines and strip ending ', '
+$mailto = preg_replace($mailto_regexp, $mailto_replace, stripslashes($_POST['_to']));
// decode address strings
$to_address_arr = $IMAP->decode_address_list($mailto);
@@ -90,10 +91,10 @@ $headers = array('Date' => date('D, j M Y G:i:s O'),
// additional recipients
if ($_POST['_cc'])
- $headers['Cc'] = preg_replace($mailto_regexp, '', $_POST['_cc']);
+ $headers['Cc'] = preg_replace($mailto_regexp, $mailto_replace, stripslashes($_POST['_cc']));
if ($_POST['_bcc'])
- $headers['Bcc'] = preg_replace($mailto_regexp, '', $_POST['_bcc']);
+ $headers['Bcc'] = preg_replace($mailto_regexp, $mailto_replace, stripslashes($_POST['_bcc']));
if (strlen($identity_arr['bcc']))
$headers['Bcc'] = ($headers['Bcc'] ? $headers['Bcc'].', ' : '') . $identity_arr['bcc'];