From: Shankari Anand <shankari.ak0208@gmail.com>
To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Shankari Anand <shankari.ak0208@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>
Subject: [PATCH v2] kconfig: nconf: Fix uncleared lines on help screens
Date: Tue, 22 Jul 2025 22:58:37 +0530 [thread overview]
Message-ID: <20250722172837.140328-1-shankari.ak0208@gmail.com> (raw)
Commit 1b92b18ec419 ("kconfig: nconf: Ensure null termination where
strncpy is used") introduced a regression where
help screens (F1, F2, F3) no longer properly clear short lines of text,
resulting in duplicated or trailing content when lines are overwritten.
Revert the null-termination change to match
the actual length of the copied string.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Closes: https://lore.kernel.org/lkml/CAK7LNAT54nvwYmTy20Ep8U2kr4thn68yYWXi9R-d3Yx3iXs=Bg@mail.gmail.com/T/#
Fixes: 1b92b18ec419 ("kconfig: nconf: Ensure null termination where strncpy is used")
Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
---
v1 -> v2: Add closes tag to the report.
Carry-forwarded acked-by and tested-by from previous version
---
scripts/kconfig/nconf.gui.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index 475a403ab8ba..7206437e784a 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -177,7 +177,7 @@ void fill_window(WINDOW *win, const char *text)
const char *line = get_line(text, i);
int len = get_line_length(line);
strncpy(tmp, line, min(len, x));
- tmp[sizeof(tmp) - 1] = '\0';
+ tmp[len] = '\0';
mvwprintw(win, i, 0, "%s", tmp);
}
}
base-commit: 05adbee3ad528100ab0285c15c91100e19e10138
--
2.34.1
next reply other threads:[~2025-07-22 17:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 17:28 Shankari Anand [this message]
2025-07-23 6:21 ` [PATCH v2] kconfig: nconf: Fix uncleared lines on help screens Nicolas Schier
2025-07-26 6:30 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250722172837.140328-1-shankari.ak0208@gmail.com \
--to=shankari.ak0208@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).