Skip to content

Commit

Permalink
ASoC: Use strlcpy() for copying in snd_soc_info_enum_double()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Takashi Iwai authored and Mark Brown committed Oct 31, 2013
1 parent 6833c45 commit a19685c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a19685c

Please sign in to comment.