From eb53f97ab64cf3f51fde80ff9ca67a5b290c20a4 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 5 Jul 2023 13:24:10 -0700 Subject: til: more strictly filter til_module_setup() It was too coarse a condition filtering the list on !name. This change actually looks up non-NULL names to verify it's a resolvable module name before producing the unfiltered list. Mostly just to prevent fat-fingered manual module inputs from resulting in unexpectedly larger and potentially dangerous module lists in interactive "invalid input" retries. Observed in the WIP rkt_scener stuff... --- src/til.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/til.c b/src/til.c index 66b2b5c..7ee4744 100644 --- a/src/til.c +++ b/src/til.c @@ -472,7 +472,13 @@ int til_module_setup(const til_settings_t *settings, til_setting_t **res_setting const char *values[nelems(modules) + 1] = {}; const char *annotations[nelems(modules) + 1] = {}; const til_settings_t *parent; - int r; + int r, filtered = 1; + + /* Only disable filtering if a *valid* name is providead. + * This is so fat-fingered names don't suddenly include a bunch of broken options. + */ + if (name && til_lookup_module(name)) + filtered = 0; parent = til_settings_get_parent(settings); @@ -487,7 +493,7 @@ int til_module_setup(const til_settings_t *settings, til_setting_t **res_setting * shouldn't be listed, it now skips hermetic if settings->parent is set. That's * used to imply this isn't the "root" module setup, hence hermetic is inappropriate. */ - if (!name) { + if (filtered) { if (modules[i]->flags & TIL_MODULE_EXPERIMENTAL) continue; -- cgit v1.2.3