From: Thorsten Blum <blum@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Cen Zhang <zzzccc427@gmail.com>,
Cezary Rojewski <cezary.rojewski@intel.com>,
bui duc phuc <phucduc.bui@gmail.com>
Cc: Thorsten Blum <blum@kernel.org>, Takashi Iwai <tiwai@suse.de>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ALSA: info: Use snprintf() in snd_info_card_create()
Date: Sat, 7 Nov 2026 01:43:37 +0100 [thread overview]
Message-ID: <20261107004338.323417-2-blum@kernel.org> (raw)
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;
reply other threads:[~2026-11-07 0:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261107004338.323417-2-blum@kernel.org \
--to=blum@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=phucduc.bui@gmail.com \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
--cc=zzzccc427@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®