Re: [PATCH] ALSA: info: Use snprintf() in snd_info_card_create()
From: Thorsten Blum
Date: Sat Nov 07 2026 - 08:04:48 EST
On Sat, Nov 07, 2026 at 10:14:38AM +0100, Takashi Iwai wrote:
> On Sat, 07 Nov 2026 01:43:37 +0100,
> Thorsten Blum wrote:
> >
> > While the current code works correctly, replace the unbounded sprintf()
> > with snprintf() to bound the formatted string to the str buffer.
> >
> > Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
>
> Shouldn't we use scnprintf() instead? Otherwise it may lead to a
> compiler warning.
The only difference between snprintf() and scnprintf() is the return
value, which is unused here. Both are correct and shouldn't trigger a
warning.