From: Aki Tuomi Date: Wed, 24 Aug 2022 07:18:46 +0000 (+0300) Subject: auth: db-dict - Sanitize lookup results before debug logging them X-Git-Tag: 2.4.0~3644 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9792ddcc5bbd5ecbdb8271528cfe83aa1646ceba;p=thirdparty%2Fdovecot%2Fcore.git auth: db-dict - Sanitize lookup results before debug logging them Avoids leaking newlines and such to logs. --- diff --git a/src/auth/db-dict.c b/src/auth/db-dict.c index 21f408e95a..7b55d31ba9 100644 --- a/src/auth/db-dict.c +++ b/src/auth/db-dict.c @@ -5,6 +5,7 @@ #include "array.h" #include "istream.h" #include "str.h" +#include "str-sanitize.h" #include "json-parser.h" #include "settings.h" #include "dict.h" @@ -374,7 +375,7 @@ static int db_dict_iter_lookup_key_values(struct db_dict_value_iter *iter) if (ret > 0) { e_debug(authdb_event(iter->auth_request), "Lookup: %s = %s", str_c(path), - key->value); + str_sanitize(key->value, UINT_MAX)); } else if (ret < 0) { e_error(authdb_event(iter->auth_request), "Failed to lookup key %s: %s", str_c(path), error); @@ -382,7 +383,7 @@ static int db_dict_iter_lookup_key_values(struct db_dict_value_iter *iter) } else if (key->key->default_value != NULL) { e_debug(authdb_event(iter->auth_request), "Lookup: %s not found, using default value %s", - str_c(path), key->key->default_value); + str_c(path), str_sanitize(key->key->default_value, UINT_MAX)); key->value = key->key->default_value; } else { return 0;