[PATCH] module-rtp-recv: fix crash on empty UDP packets

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

 



On Sat, 2014-05-31 at 23:48 +0600, Alexander E. Patrakov wrote:
> Signed-off-by: Alexander E. Patrakov <patrakov at gmail.com>
> 
> ---
>  src/modules/rtp/rtp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c
> index 570737e..8451386 100644
> --- a/src/modules/rtp/rtp.c
> +++ b/src/modules/rtp/rtp.c
> @@ -183,7 +183,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, struct
>      }
>  
>      if (size <= 0)
> -        return 0;
> +        size = 1; /* invalid or empty packet, let the recvfrom() or size check fail */

I suppose you mean recvmsg(), not recvfrom()?

I think it would be good to explain the logic a bit more in the comment.
It may not be obvious to the reader why we don't just return -1 here.

-- 
Tanu



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

  Powered by Linux