From: Takashi Iwai Date: Mon, 28 Oct 2013 13:21:46 +0000 (+0100) Subject: ASoC: Use strlcpy() for copying in snd_soc_info_enum_double() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a19685cb72bb6a80ac453e76b3ab3bb7770e1742;p=openwrt%2Fstaging%2Fblogic.git ASoC: Use strlcpy() for copying in snd_soc_info_enum_double() The provided texts aren't guaranteed to be in the fixed size. Spotted by coverity CID 139318. Signed-off-by: Takashi Iwai Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0860a7f11299..b38e0ee622df 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2552,8 +2552,9 @@ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, if (uinfo->value.enumerated.item > e->max - 1) uinfo->value.enumerated.item = e->max - 1; - strcpy(uinfo->value.enumerated.name, - e->texts[uinfo->value.enumerated.item]); + strlcpy(uinfo->value.enumerated.name, + e->texts[uinfo->value.enumerated.item], + sizeof(uinfo->value.enumerated.name)); return 0; } EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);