Skip to content

Commit 6f0e4f7

Browse files
committed
ASoC: SOF: Intel: hda: Fix potential buffer overflow by snprintf()
jira VULN-70503 cve CVE-2022-50050 commit-author Takashi Iwai <tiwai@suse.de> commit 94c1ceb upstream-diff | Adjusted context due to missing commit 71778f7("ASoC: SOF: Intel: hda: Define rom_status_reg in sof_intel_dsp_desc") snprintf() returns the would-be-filled size when the string overflows the given buffer size, hence using this value may result in the buffer overflow (although it's unrealistic). This patch replaces with a safer version, scnprintf() for papering over such a potential issue. Fixes: 29c8e43 ("ASoC: SOF: Intel: hda: add extended rom status dump to error log") Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20220801165420.25978-4-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org> (cherry picked from commit 94c1ceb) Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
1 parent 4aaae6f commit 6f0e4f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/soc/sof/intel/hda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, u32 flags)
536536

537537
for (i = 0; i < HDA_EXT_ROM_STATUS_SIZE; i++) {
538538
value = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_ROM_STATUS + i * 0x4);
539-
len += snprintf(msg + len, sizeof(msg) - len, " 0x%x", value);
539+
len += scnprintf(msg + len, sizeof(msg) - len, " 0x%x", value);
540540
}
541541

542542
dev_err(sdev->dev, "extended rom status: %s", msg);

0 commit comments

Comments
 (0)