From e7a4b1f6d7ba1c75451dc9fdd47afd3a99da3753 Mon Sep 17 00:00:00 2001 From: Grazfather Date: Sat, 26 Aug 2023 11:48:50 -0400 Subject: [PATCH] GefSetting: Validate valid bool settings --- gef.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gef.py b/gef.py index 40e3acf25..b236723b5 100644 --- a/gef.py +++ b/gef.py @@ -9809,7 +9809,12 @@ def set_setting(self, argv: Tuple[str, Any]) -> None: _type = gef.config.raw_entry(key).type try: if _type == bool: - _newval = True if new_value.upper() in ("TRUE", "T", "1") else False + if new_value.upper() in ("TRUE", "T", "1"): + _newval = True + elif new_value.upper() in ("FALSE", "F", "0"): + _newval = False + else: + raise ValueError(f"cannot parse '{new_value}' as bool") else: _newval = new_value except Exception as e: