summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>2021-03-15 17:05:22 +0100
committerTorsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no>2025-10-21 14:31:14 +0200
commit407b92b8e35601d1f4a2a2925996bf4d61b2f5cd (patch)
tree4a06e6d774329733be0af13ba585e53adbed078f
parent82fdbdac5aab969853fe15ee7ad0c24a3fe72b0d (diff)
scripts: menuconfig: proper handling of NULL character as input
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/33212 Ignoring when user inputs NULL in a text field. menuconfig exits with a python stack trace if NULL is provided as input character, therefore ignore NULL as an input character to prevent this behaviour. A NULL character may be given accidentally by the user through the following ways: - Pressing `Win` key on keyboard (Windows only) - Pressing `<CTRL>-@` / `<CTRL>-2`. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
-rwxr-xr-xmenuconfig.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/menuconfig.py b/menuconfig.py
index 7e765d3..a0ab004 100755
--- a/menuconfig.py
+++ b/menuconfig.py
@@ -1757,6 +1757,9 @@ def _input_dialog(title, initial_text, info_text=None):
_safe_curs_set(0)
return None
+ elif c == "\0": # \0 = NUL, ignore
+ pass
+
else:
s, i, hscroll = _edit_text(c, s, i, hscroll, edit_width())
@@ -2196,6 +2199,9 @@ def _jump_to_dialog():
elif c == curses.KEY_HOME:
sel_node_i = scroll = 0
+ elif c == "\0": # \0 = NUL, ignore
+ pass
+
else:
s, s_i, hscroll = _edit_text(c, s, s_i, hscroll,
_width(edit_box) - 2)