[alsa-devel] [PATCH 1/2] ucm: fix seg fault in execute_cset()

Lu Guanqun guanqun.lu at intel.com
Fri Aug 19 10:05:25 CEST 2011


When there's no space in 'cset', 'pos' gets NULL, dereferencing 'pos' gets a
seg fault. We need to be more robust.

Signed-off-by: Lu Guanqun <guanqun.lu at intel.com>
---
 src/ucm/main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/ucm/main.c b/src/ucm/main.c
index 8e9a85d..9ecbe43 100644
--- a/src/ucm/main.c
+++ b/src/ucm/main.c
@@ -196,7 +196,8 @@ static int execute_cset(snd_ctl_t *ctl, char *cset)
 		goto __fail;
 	err = 0;
       __fail:
-	*pos = ' ';
+	if (pos != NULL)
+		*pos = ' ';
 
 	if (id != NULL)
 		free(id);



More information about the Alsa-devel mailing list