diff mbox series

skl-topology_3627: using sprintf changed to snprintf

Message ID 20230217131530.486962-1-n.petrova@fintech.ru (mailing list archive)
State New, archived
Headers show
Series skl-topology_3627: using sprintf changed to snprintf | expand

Commit Message

Natalia Petrova Feb. 17, 2023, 1:15 p.m. UTC
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")
Signed-off-by: Natalia Petrova <n.petrova@fintech.ru>
---
 sound/soc/intel/skylake/skl-topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index e06eac592da1..ac06926e651d 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -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)) {