* [PATCH] ALSA: info: Use snprintf() in snd_info_card_create()
@ 2026-11-07 0:43 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-11-07 0:43 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Cen Zhang, Cezary Rojewski, bui duc phuc
Cc: Thorsten Blum, Takashi Iwai, linux-sound, linux-kernel
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@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..b0ed66d0336d 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);
+ snprintf(str, sizeof(str), "card%i", card->number);
entry = create_subdir(card->module, str);
if (!entry)
return -ENOMEM;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-07 0:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-07 0:43 [PATCH] ALSA: info: Use snprintf() in snd_info_card_create() Thorsten Blum
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®