ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs
authorTakashi Iwai <tiwai@suse.de>
Tue, 18 Feb 2020 09:14:09 +0000 (10:14 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 18 Feb 2020 09:15:41 +0000 (10:15 +0100)
commit44eeb081b8630bb3ad3cd381d1ae1831463e48bb
tree22799f2d7d68e9a71bca72600a38af044232e299
parentcc5049ae4d457194796f854eb2e38b9727ad8c2d
ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs

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>
sound/hda/hdmi_chmap.c
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_eld.c
sound/pci/hda/hda_sysfs.c