Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Update
alsa-utils
0002-amixer-expand-local-storage-for-item-name-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-amixer-expand-local-storage-for-item-name-according-.patch of Package alsa-utils
From f3abdeea00ef7cc07cb44aa43701a278b9c4692f Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto <o-takashi@sakamocchi.jp> Date: Thu, 9 Apr 2015 01:30:56 +0900 Subject: [PATCH 2/3] amixer: expand local storage for item name according to kernel code According to kernel code (snd_ctl_elem_init_enum_names() in sound/core/control.c), the maximum length of item name is 63 characters (+ 1 terminator = 64 bytes). But current amixer implementation uses 40 bytes. This causes name truncation and fail to operation. This commit fixes this bug by expanding the length of local variables. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- amixer/amixer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/amixer/amixer.c b/amixer/amixer.c index 36c92eb99bc9..db1849333da3 100644 --- a/amixer/amixer.c +++ b/amixer/amixer.c @@ -812,7 +812,11 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char if (snd_mixer_selem_is_enumerated(elem)) { int i, items; unsigned int idx; - char itemname[40]; + /* + * See snd_ctl_elem_init_enum_names() in + * sound/core/control.c. + */ + char itemname[64]; items = snd_mixer_selem_get_enum_items(elem); printf(" Items:"); for (i = 0; i < items; i++) { @@ -1255,7 +1259,9 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp) { char *ptr = *ptrp; int items, i, len; - char name[40]; + + /* See snd_ctl_elem_init_enum_names() in sound/core/control.c. */ + char name[64]; items = snd_mixer_selem_get_enum_items(elem); if (items <= 0) @@ -1264,6 +1270,7 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp) for (i = 0; i < items; i++) { if (snd_mixer_selem_get_enum_item_name(elem, i, sizeof(name)-1, name) < 0) continue; + len = strlen(name); if (! strncmp(name, ptr, len)) { if (! ptr[len] || ptr[len] == ',' || ptr[len] == '\n') { -- 2.3.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor