]> code.delx.au - pulseaudio/commitdiff
card: Don't crash if someone gives NULL name to pa_card_set_profile().
authorTanu Kaskinen <tanuk@iki.fi>
Fri, 8 Jun 2012 16:36:45 +0000 (19:36 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Fri, 29 Jun 2012 11:24:43 +0000 (14:24 +0300)
In my opinion, pa_card_set_profile() should assert that name
is not NULL, and it would be the job of the client interface
to filter out NULLs from the client input, but this is done
this way also when setting sink and source ports, so for
consistency I'll do this this way for now.

src/pulsecore/card.c

index 1d0a9ead61d59c547b795826ee81d2429476c41a..d1f0de830d4e1741b39794bdad5614e27bbd3f4d 100644 (file)
@@ -228,7 +228,7 @@ int pa_card_set_profile(pa_card *c, const char *name, pa_bool_t save) {
         return -PA_ERR_NOTIMPLEMENTED;
     }
 
-    if (!c->profiles)
+    if (!c->profiles || !name)
         return -PA_ERR_NOENTITY;
 
     if (!(profile = pa_hashmap_get(c->profiles, name)))