Re: [PATCH] kconfig: nconf: NUL-terminate 'line' correctly in fill_window()
From: Thorsten Blum
Date: Mon Aug 11 2025 - 12:40:29 EST
On 11. Aug 2025, at 17:08, Thorsten Blum wrote:
> 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.
I submitted this as a new patch instead of a v2:
https://lore.kernel.org/lkml/20250811161650.37428-2-thorsten.blum@xxxxxxxxx/
Thanks,
Thorsten