aboutsummaryrefslogtreecommitdiff
path: root/lib/imap.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-21 09:17:06 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-22 14:43:37 +0200
commit3b05f79ef8c88468e2684760ec39065c739a1f3d (patch)
treea3be24a01be8ba967621bd8bba51b46ddb218f2a /lib/imap.c
parenta4db3f70468c31c0d579e6b9dcd4e90cd9f0d1a8 (diff)
imap: quote atoms properly when escaping characters
Updates test 800 to verify Fixes #1902 Closes #1903
Diffstat (limited to 'lib/imap.c')
-rw-r--r--lib/imap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/imap.c b/lib/imap.c
index d37113aae..954d18f37 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -1797,7 +1797,7 @@ static char *imap_atom(const char *str, bool escape_only)
return strdup(str);
/* Calculate the new string length */
- newlen = strlen(str) + backsp_count + quote_count + (others_exists ? 2 : 0);
+ newlen = strlen(str) + backsp_count + quote_count + (escape_only ? 0 : 2);
/* Allocate the new string */
newstr = (char *) malloc((newlen + 1) * sizeof(char));
@@ -1806,7 +1806,7 @@ static char *imap_atom(const char *str, bool escape_only)
/* Surround the string in quotes if necessary */
p2 = newstr;
- if(others_exists) {
+ if(!escape_only) {
newstr[0] = '"';
newstr[newlen - 1] = '"';
p2++;