Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: nconf: Ensure null termination where strncpy is used

strncpy() does not guarantee null-termination if the source string is
longer than the destination buffer.

Ensure the buffer is explicitly null-terminated to prevent potential
string overflows or undefined behavior.

Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Nicolas Schier <n.schier@avm.de>
Acked-by: Nicolas Schier <n.schier@avm.de>

authored by

Shankari Anand and committed by
Masahiro Yamada
f4689929 9e0bd6db

+3
+2
scripts/kconfig/nconf.c
··· 593 593 tmp_str, 594 594 sizeof(k_menu_items[index].str)); 595 595 596 + k_menu_items[index].str[sizeof(k_menu_items[index].str) - 1] = '\0'; 597 + 596 598 free_item(curses_menu_items[index]); 597 599 curses_menu_items[index] = new_item( 598 600 k_menu_items[index].str,
+1
scripts/kconfig/nconf.gui.c
··· 359 359 x = (columns-win_cols)/2; 360 360 361 361 strncpy(result, init, *result_len); 362 + result[*result_len - 1] = '\0'; 362 363 363 364 /* create the windows */ 364 365 win = newwin(win_lines, win_cols, y, x);