Skip to content

Commit d516838

Browse files
committed
scripts: menuconfig: proper handling of NULL character as input
Fixes: zephyrproject-rtos#33212 Upstream PR: ulfalizer/Kconfiglib#103 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 <[email protected]>
1 parent 2857c2e commit d516838

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/kconfig/menuconfig.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,9 @@ def edit_width():
17571757
_safe_curs_set(0)
17581758
return None
17591759

1760+
elif c == "\0": # \0 = NUL, ignore
1761+
pass
1762+
17601763
else:
17611764
s, i, hscroll = _edit_text(c, s, i, hscroll, edit_width())
17621765

@@ -2196,6 +2199,9 @@ def select_prev_match():
21962199
elif c == curses.KEY_HOME:
21972200
sel_node_i = scroll = 0
21982201

2202+
elif c == "\0": # \0 = NUL, ignore
2203+
pass
2204+
21992205
else:
22002206
s, s_i, hscroll = _edit_text(c, s, s_i, hscroll,
22012207
_width(edit_box) - 2)

0 commit comments

Comments
 (0)