diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-02-18 10:14:09 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-02-28 17:22:12 +0100 |
commit | 80c1e9c4c4846187876d4a9f9467601a37571fa7 (patch) | |
tree | 08aeda98c30d25ba4aca722413b7a70ca9bf6ddb /sound/hda | |
parent | b76e00b67dc61d5bbd0cc21f51d14703c767510d (diff) | |
download | linux-stable-80c1e9c4c4846187876d4a9f9467601a37571fa7.tar.gz linux-stable-80c1e9c4c4846187876d4a9f9467601a37571fa7.tar.bz2 linux-stable-80c1e9c4c4846187876d4a9f9467601a37571fa7.zip |
ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs
commit 44eeb081b8630bb3ad3cd381d1ae1831463e48bb upstream.
Some code in HD-audio driver calls snprintf() in a loop and still
expects that the return value were actually written size, while
snprintf() returns the expected would-be length instead. When the
given buffer limit were small, this leads to a buffer overflow.
Use scnprintf() for addressing those issues. It returns the actually
written size unlike snprintf().
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200218091409.27162-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/hda')
-rw-r--r-- | sound/hda/hdmi_chmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/hda/hdmi_chmap.c b/sound/hda/hdmi_chmap.c index 886cb7811bd6..2efee794cac6 100644 --- a/sound/hda/hdmi_chmap.c +++ b/sound/hda/hdmi_chmap.c @@ -250,7 +250,7 @@ void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen) for (i = 0, j = 0; i < ARRAY_SIZE(cea_speaker_allocation_names); i++) { if (spk_alloc & (1 << i)) - j += snprintf(buf + j, buflen - j, " %s", + j += scnprintf(buf + j, buflen - j, " %s", cea_speaker_allocation_names[i]); } buf[j] = '\0'; /* necessary when j == 0 */ |