]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: settings_check() - Avoid growing data stack unnecessarily
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 16 Nov 2020 12:56:50 +0000 (14:56 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 4 May 2021 07:02:35 +0000 (07:02 +0000)
Each check_func() could have increased data stack usage. Add it inside
a data stack frame to avoid it growing unnecessarily large.

src/lib-settings/settings-parser.c

index 4fc662ba90ae4d4e8c9d70d2c1f8dcab74718581..7b63b30f25f4145f8498f9e46c7687b6b76b19f2 100644 (file)
@@ -1193,9 +1193,13 @@ bool settings_check(const struct setting_parser_info *info, pool_t pool,
        const ARRAY_TYPE(void_array) *val;
        void *const *children;
        unsigned int i, count;
+       bool valid;
 
        if (info->check_func != NULL) {
-               if (!info->check_func(set, pool, error_r))
+               T_BEGIN {
+                       valid = info->check_func(set, pool, error_r);
+               } T_END_PASS_STR_IF(!valid, error_r);
+               if (!valid)
                        return FALSE;
        }