diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-07-05 13:24:10 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-07-05 13:24:10 -0700 |
commit | eb53f97ab64cf3f51fde80ff9ca67a5b290c20a4 (patch) | |
tree | 0120a0ab60e40524f11343ce572559e7e7c8b63e /src | |
parent | b66147bef15f6cb7fcb9d15f121d1e345a7af970 (diff) |
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...
Diffstat (limited to 'src')
-rw-r--r-- | src/til.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; |