]> git.baikalelectronics.ru Git - kernel.git/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)
committerMark Brown <broonie@kernel.org>
Wed, 19 Feb 2020 13:36:16 +0000 (13:36 +0000)
commit98fec7c9e5c67a4d95968a1a4a2a0ab1ad95b179
tree0cfc14d424689fe2d30059103a876b8510f4dad4
parentb47cb1767e93f5500dc863979ca12c7a2067eebf
ASoC: pcm: Fix possible buffer overflow in dpcm state sysfs output

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: 6c4a0c1684b8 ("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>
sound/soc/soc-pcm.c