[PATCH 2/2] bluetooth: Fix negative array index write

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

 



On Tue, 2016-08-16 at 16:06 +0200, Peter Meerwald-Stadler wrote:
> From: Peter Meerwald <p.meerwald at bct-electronic.com>
> 
> CID 1533121
> 
> Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
> ---
>  src/modules/bluetooth/backend-native.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/bluetooth/backend-native.c
> b/src/modules/bluetooth/backend-native.c
> index 86376c0..b5f78f5 100644
> --- a/src/modules/bluetooth/backend-native.c
> +++ b/src/modules/bluetooth/backend-native.c
> @@ -232,13 +232,16 @@ static void rfcomm_io_callback(pa_mainloop_api
> *io, pa_io_event *e, int fd, pa_i
>          int gain;
>  
>          len = read(fd, buf, 511);
> +        if (len < 0) {
> +            pa_log_error("RFCOMM read error: %s",
> pa_cstrerror(errno));
> +            goto fail;
> +        }

This is certainly an improvement. Maybe we should use pa_read() instead
of read() to handle EINTR, though?

-- 
Tanu


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

  Powered by Linux