From 1a0a6acb3f9ebee29eae82a99a83eb060a60112a Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 1 Aug 2018 08:47:34 +0300 Subject: [PATCH] doveconf: Do not skip over secrets when hiding them All candidates for hiding need to be considered, otherwise it might skip over some of them and leave them unhidden. --- src/config/doveconf.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 73e7b1261c..f4cc593035 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -182,14 +182,17 @@ static bool value_need_quote(const char *value) static const char *find_next_secret(const char *input, const char **secret_r) { const char *const *secret; + const char *ptr = NULL; for(secret = secrets; *secret != NULL; secret++) { - const char *ptr; - if ((ptr = strstr(input, *secret)) != NULL) { - *secret_r = *secret; - return ptr; + const char *cptr; + if ((cptr = strstr(input, *secret)) != NULL) { + if (ptr == NULL || cptr < ptr) { + *secret_r = *secret; + ptr = cptr; + } } } - return NULL; + return ptr; } static bool -- 2.47.3