[PATCH v2 10/10] raop: Fix potential NULL dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Mar 6, 2017, at 1:43 AM, Peter Meerwald-Stadler <pmeerw at pmeerw.net> wrote:
> 
> 'realm' is mandatory
> 
> Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
> ---
> src/modules/raop/raop-client.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/raop/raop-client.c b/src/modules/raop/raop-client.c
> index d329a09..5248691 100644
> --- a/src/modules/raop/raop-client.c
> +++ b/src/modules/raop/raop-client.c
> @@ -1254,13 +1254,13 @@ static void rtsp_auth_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_st
>                     pa_xfree(token);
>                 }
> 
> -                if (pa_safe_streq(mth, "Basic")) {
> +                if (pa_safe_streq(mth, "Basic") && realm) {
>                     rtrim_char(realm, '\"â??);

I would remove `rtrim_char(realm, '\"â??);` from this block and keep the if condition as-is, since realm is not used later.

> 
>                     pa_raop_basic_response(DEFAULT_USER_NAME, c->password, &response);
>                     ath = pa_sprintf_malloc("Basic %s",
>                         response);
> -                } else if (pa_safe_streq(mth, "Digest")) {
> +                } else if (pa_safe_streq(mth, "Digest") && realm && nonce) {

Why donâ??t we do like this:
+                    if (realm == NULL) {
+                        pa_log_error("realm not provided");
+                        goto error;
+                    } else if (nonce == NULL) {
+                        pa_log_error("nonce not provided");
+                        goto error;
+                    }

>                     rtrim_char(realm, '\"');
>                     rtrim_char(nonce, '\"');
> 
> -- 
> 2.7.4
> 
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux