From: Antonio Ospite Subject: [alsa-lib][PATCH] ucm: fix crash when calling snd_use_case_geti() with no device or modifier Date: Fri, 23 Sep 2016 18:11:16 +0200 Message-ID: <20160923161116.26359-1-ao2@ao2.it> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp205.alice.it (smtp205.alice.it [82.57.200.101]) by alsa0.perex.cz (Postfix) with ESMTP id A16D62665D9 for ; Fri, 23 Sep 2016 18:11:31 +0200 (CEST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: alsa-devel@alsa-project.org Cc: Takashi Iwai , Antonio Ospite List-Id: alsa-devel@alsa-project.org When calling snd_use_case_geti(uc_mgr, "_devstatus", &lvalue) the code ends up calling device_status(uc_mgr, NULL), which result in a crash in strcmp(dev->name, NULL), when there are enabled devices. This happens because snd_use_case_geti() allows a "_devstatus" identifier even if it's only supposed to allow the form "_devstatus/{device}". So check that the device name is not null. The same issue occurs with "_modstatus", this change fixes that as well. Signed-off-by: Antonio Ospite --- Hi, the bug can be reproduced with a command like this: # alsaucm -n -b - <= 0) { *value = err; err = 0; } } else if (check_identifier(identifier, "_modstatus")) { + if(!str) { + err = -EINVAL; + goto __end; + } err = modifier_status(uc_mgr, str); if (err >= 0) { *value = err; -- 2.9.3