Skip to contentSkip to conversation

skl-topology_3627: using sprintf changed to snprintf

PATCH New Natalia Petrova 1 participant 1 message Feb 17, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 skl-topology_3627: using sprintf changed to snprintf

Use snprintf instead of sprintf to avoid buffer overflow.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 2d744ecf2b98 ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT")
---
 sound/soc/intel/skylake/skl-topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl-topology.c +1 -1
index e06eac592da1..ac06926e651d 100644
@@ -3660,7 +3660,7 @@ static int skl_tplg_complete(struct snd_soc_component *component)
 
 		se = (struct soc_enum *)kcontrol->private_value;
 		texts = dobj->control.dtexts;
-		sprintf(chan_text, "c%d", mach->mach_params.dmic_num);
+		snprintf(chan_text, sizeof(chan_text), "c%d", mach->mach_params.dmic_num);
 
 		for (i = 0; i < se->items; i++) {
 			if (strstr(texts[i], chan_text)) {
Signature · 1 line
2.34.1