Skip to content

Commit a3c60eb

Browse files
committed
kconfig: Handle NULL character as input properly
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 3249d0e commit a3c60eb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/kconfig/menuconfig.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,9 @@ def edit_width():
17681768
_safe_curs_set(0)
17691769
return None
17701770

1771+
elif c == "\0": # \0 = NUL, ignore
1772+
pass
1773+
17711774
else:
17721775
s, i, hscroll = _edit_text(c, s, i, hscroll, edit_width())
17731776

@@ -2207,6 +2210,9 @@ def select_prev_match():
22072210
elif c == curses.KEY_HOME:
22082211
sel_node_i = scroll = 0
22092212

2213+
elif c == "\0": # \0 = NUL, ignore
2214+
pass
2215+
22102216
else:
22112217
s, s_i, hscroll = _edit_text(c, s, s_i, hscroll,
22122218
_width(edit_box) - 2)

0 commit comments

Comments
 (0)