sprintf() does not perform bounds checking. Replace it with snprintf()
using sizeof(name) to follow safer coding practices and make the buffer
size explicit, consistent with how similar fixes have been applied
elsewhere in the codebase
Signed-off-by: Nishant Kumar Singh <nishantsingh2jan1998@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
snd_pcm_stream_name(stream));
while (card >= 0) {
char name[32];
snd_pcm_stream_name(stream));
while (card >= 0) {
char name[32];
- sprintf(name, "hw:%d", card);
+ snprintf(name, sizeof(name), "hw:%d", card);
if ((err = snd_ctl_open(&handle, name, 0)) < 0) {
error("control open (%i): %s", card, snd_strerror(err));
goto next_card;
if ((err = snd_ctl_open(&handle, name, 0)) < 0) {
error("control open (%i): %s", card, snd_strerror(err));
goto next_card;