]> 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)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 21 Aug 2018 09:13:23 +0000 (12:13 +0300)
Broken by fc02343f

src/config/doveconf.c

index 873a3cb24b98fda5758766fa44a3a067cb9ffe4f..625a3aaaa94da066c30ba09a31d2f5d18827f3e1 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);
        }