ASoC: intel: skl: Fix possible buffer overflow in debug outputs
authorTakashi Iwai <tiwai@suse.de>
Tue, 18 Feb 2020 11:17:36 +0000 (12:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Mar 2020 12:00:25 +0000 (13:00 +0100)
commitbbc02b018d73b796d5cfa1dcba83d04a87312463
treef1174e08acf1b2a9b5c2f3f849c5435d5ad735bf
parent1dd4d68f19cfee62d1fa24d7650b80a7d6c2c04d
ASoC: intel: skl: Fix possible buffer overflow in debug outputs

commit 549cd0ba04dcfe340c349cd983bd440480fae8ee upstream.

The debugfs output of intel skl driver writes strings with multiple
snprintf() calls with the fixed size.  This was supposed to avoid the
buffer overflow but actually it still would, because snprintf()
returns the expected size to be output, not the actual output size.

Fix it by replacing snprintf() calls with scnprintf().

Fixes: d14700a01f91 ("ASoC: Intel: Skylake: Debugfs facility to dump module config")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200218111737.14193-3-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/intel/skylake/skl-debug.c