From b7d705e8c2b9bdd4f85332db06b415385f98d63c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 4 Mar 2003 03:10:28 +0200 Subject: [PATCH] Use literals for strings containing '"' and '\' characters too. This wasn't done at all before so FETCH ENVELOPE, BODY and BODYSTRUCTURE could have returned pretty broken results. --HG-- branch : HEAD --- src/lib-imap/imap-quote.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib-imap/imap-quote.c b/src/lib-imap/imap-quote.c index 66c15a5e61..3878f69447 100644 --- a/src/lib-imap/imap-quote.c +++ b/src/lib-imap/imap-quote.c @@ -19,12 +19,13 @@ void imap_quote_append(string_t *str, const unsigned char *value, if (value[i] == 13 || value[i] == 10) linefeeds++; - if ((value[i] & 0x80) != 0) + if ((value[i] & 0x80) != 0 || + value[i] == '"' || value[i] == '\\') literal = TRUE; } if (!literal) { - /* no 8bit chars, return as "string" */ + /* no 8bit chars or imapspecials, return as "string" */ str_append_c(str, '"'); } else { /* return as literal */ -- 2.47.3