ASoC: Use strlcpy() for copying in snd_soc_info_enum_double()
authorTakashi Iwai <tiwai@suse.de>
Mon, 28 Oct 2013 13:21:46 +0000 (14:21 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 31 Oct 2013 17:57:47 +0000 (10:57 -0700)
The provided texts aren't guaranteed to be in the fixed size.
Spotted by coverity CID 139318.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/soc-core.c

index 0860a7f112992caee60f3cf0498256ee7a46d96d..b38e0ee622df2709a680d46eb11b47c1c389bad9 100644 (file)
@@ -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);