Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE
alsa.6660
0016-ucm-Assure-the-user-input-card-name-not-to...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0016-ucm-Assure-the-user-input-card-name-not-to-exceed-ma.patch of Package alsa.6660
From 2b9b3f013467765219c8ab8a50943d3c7db68f75 Mon Sep 17 00:00:00 2001 From: Mengdong Lin <mengdong.lin@linux.intel.com> Date: Wed, 18 Jan 2017 11:52:35 +0800 Subject: [PATCH 16/43] ucm: Assure the user input card name not to exceed max size of card long name Users can load a card's UCM configuration file by giving the card short name or long name, which should not exceed the maximum card long name defined by the kernel. The kernel uses an 80-character buffer to store the card long name. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- src/ucm/parser.c | 6 ++++++ src/ucm/ucm_local.h | 1 + 2 files changed, 7 insertions(+) --- a/src/ucm/parser.c +++ b/src/ucm/parser.c @@ -1335,6 +1335,12 @@ static int load_master_config(const char char *env = getenv(ALSA_CONFIG_UCM_VAR); int err; + if (strnlen(card_name, MAX_CARD_LONG_NAME) == MAX_CARD_LONG_NAME) { + uc_error("error: invalid card name %s (at most %d chars)\n", + card_name, MAX_CARD_LONG_NAME - 1); + return -EINVAL; + } + snprintf(filename, sizeof(filename)-1, "%s/%s/%s.conf", env ? env : ALSA_USE_CASE_DIR, card_name, card_name); --- a/src/ucm/ucm_local.h +++ b/src/ucm/ucm_local.h @@ -41,6 +41,7 @@ #include "use-case.h" #define MAX_FILE 256 +#define MAX_CARD_LONG_NAME 80 #define ALSA_USE_CASE_DIR ALSA_CONFIG_DIR "/ucm" #define SEQUENCE_ELEMENT_TYPE_CDEV 1
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