linux/scripts/kconfig
Xingjing Deng 93085ce89a kconfig: fix potential NULL pointer dereference in conf_askvalue
[ Upstream commit b9d21c32dc ]

In conf_askvalue(), the 'def' argument (retrieved via sym_get_string_value)
can be NULL. While current call sites ensure that 'def' is valid,
calling printf("%s\n", def) is technically undefined behavior and could
lead to a segmentation fault on certain libc implementations if the
function were called with a NULL pointer in the future.

Improve the robustness of conf_askvalue() by providing an empty string
as a fallback.

Additionally, remove the redundant re-initialization of the 'line'
buffer inside the !sym_is_changeable(sym) block, as it is already
properly initialized at the function entry.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Xingjing Deng <micro6947@gmail.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20260306021709.27068-1-micro6947@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-07-24 15:51:28 +02:00
..
lxdialog kconfig: lxdialog: fix 'space' to (de)select options 2025-08-28 16:24:25 +02:00
tests kconfig: change "modules" from sub-option to first-level attribute 2021-04-14 15:22:49 +09:00
.gitignore kconfig: refactor .gitignore 2021-04-26 02:17:39 +09:00
conf.c kconfig: fix potential NULL pointer dereference in conf_askvalue 2026-07-24 15:51:28 +02:00
confdata.c kconfig: WERROR unmet symbol dependency 2025-03-13 12:50:14 +01:00
expr.c kconfig: remove wrong expr_trans_bool() 2024-07-27 10:46:09 +02:00
expr.h kconfig: remove wrong expr_trans_bool() 2024-07-27 10:46:09 +02:00
gconf-cfg.sh kbuild: Allow kernel installation packaging to override pkg-config 2023-02-01 08:27:30 +01:00
gconf.c kconfig: gconf: fix potential memory leak in renderer_edited() 2025-08-28 16:24:25 +02:00
gconf.glade scripts/kconfig/gconf.glade Update broken web addresses. 2010-09-17 16:54:42 +02:00
images.c kconfig: constify XPM data 2020-08-14 13:30:03 +09:00
images.h kconfig: constify XPM data 2020-08-14 13:30:03 +09:00
internal.h kconfig: split menu.c out of parser.y 2021-04-14 15:26:09 +09:00
lexer.l kconfig: fix infinite loop when expanding a macro at the end of file 2024-03-26 18:21:34 -04:00
list.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
lkc.h kconfig: remove unused PACKAGE definition 2021-04-19 14:50:16 +09:00
lkc_proto.h kconfig: WERROR unmet symbol dependency 2025-03-13 12:50:14 +01:00
Makefile kconfig: split menu.c out of parser.y 2021-04-14 15:26:09 +09:00
mconf-cfg.sh kbuild: Allow kernel installation packaging to override pkg-config 2023-02-01 08:27:30 +01:00
mconf.c kconfig/mconf: Initialize the default locale at startup 2025-12-07 06:09:31 +09:00
menu.c kconfig: remove wrong expr_trans_bool() 2024-07-27 10:46:09 +02:00
merge_config.sh kconfig: merge_config: use an empty file as initfile 2025-06-04 14:37:54 +02:00
nconf-cfg.sh kbuild: Allow kernel installation packaging to override pkg-config 2023-02-01 08:27:30 +01:00
nconf.c kconfig/nconf: Initialize the default locale at startup 2025-12-07 06:09:31 +09:00
nconf.gui.c kconfig: nconf: Ensure null termination where strncpy is used 2025-08-28 16:24:25 +02:00
nconf.h kconfig: nconf: refactor in print_in_middle() 2021-04-14 15:25:43 +09:00
parser.y kconfig: split menu.c out of parser.y 2021-04-14 15:26:09 +09:00
preprocess.c kconfig: fix possible buffer overflow 2023-09-19 12:22:56 +02:00
qconf-cfg.sh kbuild: Allow kernel installation packaging to override pkg-config 2023-02-01 08:27:30 +01:00
qconf.cc kconfig: qconf: fix ConfigList::updateListAllforAll() 2025-08-28 16:24:12 +02:00
qconf.h kconfig: qconf: remove Y, M, N columns 2020-09-25 00:37:13 +09:00
streamline_config.pl streamline_config.pl: add softtabstop=4 for vim users 2021-06-29 10:53:45 -07:00
symbol.c kconfig: fix memory leak in sym_warn_unmet_dep() 2025-03-13 12:50:14 +01:00
util.c kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00