]> 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)
commit914ec860269632fa30edcbc900edfea897f243b7
tree0cfc14d424689fe2d30059103a876b8510f4dad4
parent95b811dfd46155500cb893c3c707aa8c8f50ab90
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: 3af640c00582 ("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