* [PATCH v2] ALSA: info: Use scnprintf() in snd_info_card_create()
@ 2026-11-07 14:09 Thorsten Blum
2026-11-08 9:28 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-11-07 14:09 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Cezary Rojewski, Cen Zhang, bui duc phuc
Cc: Thorsten Blum, Takashi Iwai, linux-sound, linux-kernel
While the current code works correctly, replace the unbounded sprintf()
with scnprintf() to bound the formatted string to the str buffer.
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
Changes in v2:
- Switch to scnprintf() as suggested by Takashi
- v1: https://lore.kernel.org/r/20261107004338.323417-2-blum@kernel.org/
sound/core/info.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/info.c b/sound/core/info.c
index 023b4736aa6d..2c2a80a7d0d2 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -484,7 +484,7 @@ int snd_info_card_create(struct snd_card *card)
if (snd_BUG_ON(!card))
return -ENXIO;
- sprintf(str, "card%i", card->number);
+ scnprintf(str, sizeof(str), "card%i", card->number);
entry = create_subdir(card->module, str);
if (!entry)
return -ENOMEM;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ALSA: info: Use scnprintf() in snd_info_card_create()
2026-11-07 14:09 [PATCH v2] ALSA: info: Use scnprintf() in snd_info_card_create() Thorsten Blum
@ 2026-11-08 9:28 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-11-08 9:28 UTC (permalink / raw)
To: Thorsten Blum
Cc: Jaroslav Kysela, Takashi Iwai, Cezary Rojewski, Cen Zhang,
bui duc phuc, Takashi Iwai, linux-sound, linux-kernel
On Sat, 07 Nov 2026 15:09:48 +0100,
Thorsten Blum wrote:
>
> While the current code works correctly, replace the unbounded sprintf()
> with scnprintf() to bound the formatted string to the str buffer.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
Applied to for-next branch now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-08 9:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-07 14:09 [PATCH v2] ALSA: info: Use scnprintf() in snd_info_card_create() Thorsten Blum
2026-11-08 9:28 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®