From 52f8caf7706cbdd6087ac9c555270604554db5ef Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 21 Mar 2008 08:36:21 -0400
Subject: [PATCH] Correctly quote email recipient string

---
 program/include/rcube_imap.inc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 94f5017..170e4a5 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -2285,7 +2285,7 @@
       $address = $val['address'];
       $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', trim($val['name']));
       if ($name && $address && $name != $address)
-        $string = sprintf('%s <%s>', strpos($name, ',')!==FALSE ? '"'.$name.'"' : $name, $address);
+        $string = sprintf('%s <%s>', preg_match('/[,;<>]/', $name) ? '"'.addcslashes($name, '"').'"' : $name, $address);
       else if ($address)
         $string = $address;
       else if ($name)

--
Gitblit v1.9.1