From: Aki Tuomi Date: Wed, 9 May 2018 07:19:02 +0000 (+0300) Subject: config: Fix crash in doveconf -n when hiding sensitive information X-Git-Tag: 2.3.4~304 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0a6ae9394d6cf1abcbc43ac54eddffdf7938fb8;p=thirdparty%2Fdovecot%2Fcore.git config: Fix crash in doveconf -n when hiding sensitive information Broken by fc02343f --- diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 873a3cb24b..625a3aaaa9 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -209,8 +209,10 @@ hide_secrets_from_value(struct ostream *output, const char *key, ptr++; len = (size_t)(ptr-optr); if (quote) { - o_stream_nsend_str(output, - str_nescape(optr, len)); + string_t *quoted = t_str_new(len*2); + str_append_escaped(quoted, optr, len); + o_stream_nsend(output, + quoted->data, quoted->used); } else { o_stream_nsend(output, optr, len); } @@ -228,11 +230,11 @@ hide_secrets_from_value(struct ostream *output, const char *key, Skip forward to avoid infinite loop. */ ptr++; } - } + }; /* if we are dealing with output, send rest here */ if (ret) { if (quote) - o_stream_nsend_str(output, str_escape(ptr)); + o_stream_nsend_str(output, str_escape(optr)); else o_stream_nsend_str(output, optr); }