From d749c280bf50e93e0de1da1d59cd8c5705f99577 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 25 Mar 2020 15:52:02 +0200 Subject: [PATCH] lib-imap: imap_arg_get/as_nstring() - fail if input is an atom Atoms were wrongly allowed in these places. These have been used in very few places, so this change should be pretty safe to do. The only affected places are: * SETMETADATA - Backwards compatibility preserved by earlier commit * ID - It's not expected that any clients use atoms here * imapc - Server replies are parsed more strictly now --- src/lib-imap/imap-arg.c | 2 +- src/lib-imap/imap-bodystructure.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib-imap/imap-arg.c b/src/lib-imap/imap-arg.c index 3011b5fd00..0b947ce814 100644 --- a/src/lib-imap/imap-arg.c +++ b/src/lib-imap/imap-arg.c @@ -47,7 +47,7 @@ bool imap_arg_get_nstring(const struct imap_arg *arg, const char **str_r) *str_r = NULL; return TRUE; } - return imap_arg_get_astring(arg, str_r); + return imap_arg_get_string(arg, str_r); } bool imap_arg_get_literal_size(const struct imap_arg *arg, uoff_t *size_r) diff --git a/src/lib-imap/imap-bodystructure.c b/src/lib-imap/imap-bodystructure.c index 8b0bc92b8a..705447f1c4 100644 --- a/src/lib-imap/imap-bodystructure.c +++ b/src/lib-imap/imap-bodystructure.c @@ -726,9 +726,6 @@ static bool str_append_nstring(string_t *str, const struct imap_arg *arg) case IMAP_ARG_NIL: str_append(str, "NIL"); break; - case IMAP_ARG_ATOM: - str_append(str, cstr); - break; case IMAP_ARG_STRING: str_append_c(str, '"'); /* NOTE: we're parsing with no-unescape flag, -- 2.47.3