]> git.alsa-project.org Git - alsa-lib.git/commitdiff
ucm: fix seg fault in execute_cset()
authorLu Guanqun <guanqun.lu@intel.com>
Fri, 19 Aug 2011 08:05:25 +0000 (16:05 +0800)
committerTakashi Iwai <tiwai@suse.de>
Fri, 19 Aug 2011 08:41:26 +0000 (10:41 +0200)
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@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/ucm/main.c

index 8e9a85d2939f412518529f9a6a20c7978b8007f5..9ecbe4351cf3fcb9bc52686eac28715fac92207c 100644 (file)
@@ -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);