[pulseaudio-discuss] [PATCH] card: Don't crash if someone gives NULL name to pa_card_set_profile().

Tanu Kaskinen tanuk at iki.fi
Fri Jun 29 04:49:18 PDT 2012


On Fri, 2012-06-08 at 19:36 +0300, Tanu Kaskinen wrote:
> 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 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
> index 1d0a9ea..d1f0de8 100644
> --- a/src/pulsecore/card.c
> +++ b/src/pulsecore/card.c
> @@ -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)))

Pushed.

-- 
Tanu



More information about the pulseaudio-discuss mailing list