diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-20 18:07:21 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-20 18:25:27 +0200 |
commit | df803e1389716bcdf11932fff47d7f1fc198bc8a (patch) | |
tree | 9f5942d72a648d3686aa0967f6795da07485853c /sound | |
parent | be93709cb13a1947fec3493267d04cd87baf497e (diff) | |
download | linux-df803e1389716bcdf11932fff47d7f1fc198bc8a.tar.gz linux-df803e1389716bcdf11932fff47d7f1fc198bc8a.tar.bz2 linux-df803e1389716bcdf11932fff47d7f1fc198bc8a.zip |
ALSA: control: Warn if too long string is passed to snd_ctl_enum_info()
This allows us to catch the bugs in drivers easily.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/control.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index b9611344ff9e..f95df84437e1 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1747,6 +1747,9 @@ int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels, info->value.enumerated.items = items; if (info->value.enumerated.item >= items) info->value.enumerated.item = items - 1; + WARN(strlen(names[info->value.enumerated.item]) >= sizeof(info->value.enumerated.name), + "ALSA: too long item name '%s'\n", + names[info->value.enumerated.item]); strlcpy(info->value.enumerated.name, names[info->value.enumerated.item], sizeof(info->value.enumerated.name)); |