On Wed, 2013-05-22 at 13:33 +0200, David Henningsson wrote:
> e->description is a pointer, not a fixed char array. Hence it
> makes no sense to use strncmp.
> 
> This fixes a compiler warning when compiling under Ubuntu.
> 
> Signed-off-by: David Henningsson <[email protected]>
> ---
>  src/modules/module-device-manager.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/module-device-manager.c 
> b/src/modules/module-device-manager.c
> index 207870d..390046f 100644
> --- a/src/modules/module-device-manager.c
> +++ b/src/modules/module-device-manager.c
> @@ -889,7 +889,7 @@ static pa_hook_result_t sink_new_hook_callback(pa_core 
> *c, pa_sink_new_data *new
>      name = pa_sprintf_malloc("sink:%s", new_data->name);
>  
>      if ((e = entry_read(u, name))) {
> -        if (e->user_set_description && strncmp(e->description, 
> pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), 
> sizeof(e->description)) != 0) {
> +        if (e->user_set_description && strcmp(e->description, 
> pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION)) != 0) {

pa_proplist_gets() can return NULL, and if it does that, strcmp() will
crash.

Also, pa_streq() would be nice here.

-- 
Tanu

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to