[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4B3C8558-81F3-4965-A09C-CE07D6A5FF4A@linux.dev>
Date: Mon, 11 Aug 2025 17:08:07 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Franco Martelli <martellif67@...il.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Randy Dunlap <rdunlap@...radead.org>,
Nicolas Schier <nicolas.schier@...ux.dev>,
Shankari Anand <shankari.ak0208@...il.com>,
"nir.tzachar@...il.com" <nir.tzachar@...il.com>,
Michal Marek <mmarek@...e.cz>,
stable@...r.kernel.org,
linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kconfig: nconf: NUL-terminate 'line' correctly in
fill_window()
On 11. Aug 2025, at 14:51, Franco Martelli wrote:
> Is there a rationale behind the choice to avoid to use snprintf()
> in these circumstance?
> Preferring snprintf() you will not have to take care to
> compute the position of the NULL terminating character of the
> string, it's done automatically by this function.
I looked into it a bit more and I think we need neither strncpy() nor
snprintf() (and no temporary buffer) because this should be sufficient:
mvwprintw(win, i, 0, "%.*s", len, line);
Unless I'm missing something, I'm happy to send a v2.
Thanks,
Thorsten
Powered by blists - more mailing lists