]> git.itanic.dy.fi Git - linux-stable/commit
ASoC: pcm: Fix possible buffer overflow in dpcm state sysfs output
authorTakashi Iwai <tiwai@suse.de>
Tue, 18 Feb 2020 11:17:37 +0000 (12:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Mar 2020 13:15:08 +0000 (14:15 +0100)
commit9191f26b9d90fef35519846a07b5ea25117072e6
tree34775ae9a7a4e12453868289a239952e4afdf6f4
parent2aa6a19ec45b7c4b9c3455b2e95dd6f44581dacb
ASoC: pcm: Fix possible buffer overflow in dpcm state sysfs output

commit 6c89ffea60aa3b2a33ae7987de1e84bfb89e4c9e upstream.

dpcm_show_state() invokes multiple snprintf() calls to concatenate
formatted strings on the fixed size buffer.  The usage of snprintf()
is supposed for avoiding the buffer overflow, but it doesn't work as
expected because snprintf() doesn't return the actual output size but
the size to be written.

Fix this bug by replacing all snprintf() calls with scnprintf()
calls.

Fixes: f86dcef87b77 ("ASoC: dpcm: Add debugFS support for DPCM")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200218111737.14193-4-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/soc-pcm.c