Re: [PATCH] kconfig: nconf: NUL-terminate 'line' correctly in fill_window()

From: Thorsten Blum
Date: Mon Aug 11 2025 - 11:10:52 EST


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