[PATCH] ASoC: wm_adsp: Use scnprintf() for the limited buffer output

Charles Keepax ckeepax at opensource.cirrus.com
Fri Mar 13 14:25:07 CET 2020


On Fri, Mar 13, 2020 at 02:03:34PM +0100, Takashi Iwai wrote:
> snprintf() is a hard-to-use function, it's especially difficult to use
> it for concatenating substrings in a buffer with a limited size.
> Since snprintf() returns the would-be-output size, not the actual
> size, the subsequent use of snprintf() may point to the incorrect
> position.
> 
> Use scnprintf() instead for fixing such potential errors.
> 
> Signed-off-by: Takashi Iwai <tiwai at suse.de>
> ---

Acked-by: Charles Keepax <ckeepax at opensource.cirrus.com>

Thanks,
Charles


More information about the Alsa-devel mailing list