]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Fix crash in doveconf -n when hiding sensitive information
authorAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 9 May 2018 07:19:02 +0000 (10:19 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 14 May 2018 13:22:28 +0000 (13:22 +0000)
Broken by fc02343f

src/config/doveconf.c

index 60c5106118af20d6763b0610ea397588d3915ad8..991ce66ab811fff0ffba3162e3d1d20fc465c369 100644 (file)
@@ -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);
        }