Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1311660

Re: [PATCH] xen: fix potential integer overflow in queue_reply

From David Vrabel <david.vrabel@citrix.com>
Newsgroups linux.kernel
Subject Re: [PATCH] xen: fix potential integer overflow in queue_reply
Date 2016-01-18 17:40 +0100
Message-ID <qSl0t-3eo-3@gated-at.bofh.it> (permalink)
References <qSkQO-38H-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 18/01/16 16:29, Insu Yun wrote:
> When len is greater than UINT_MAX - sizeof(*rb), in next allocation,
> it can overflow integer range and allocates small size of heap.
> After that, memcpy will overflow the allocated heap.
> Therefore, it needs to check the size of given length.
[...]
> --- a/drivers/xen/xenbus/xenbus_dev_frontend.c
> +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
> @@ -186,7 +186,7 @@ static int queue_reply(struct list_head *queue, const void *data, size_t len)
>  {
>  	struct read_buffer *rb;
>  
> -	if (len == 0)
> +	if (len == 0 || len >= UINT_MAX - sizeof(*rb))
                               ^^^^^^^^^^^^^^^^^^^^^^
Please check

    len > XENSTORE_PAYLOAD_MAX

instead.

David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] xen: fix potential integer overflow in queue_reply Insu Yun <wuninsu@gmail.com> - 2016-01-18 17:30 +0100
  Re: [PATCH] xen: fix potential integer overflow in queue_reply David Vrabel <david.vrabel@citrix.com> - 2016-01-18 17:40 +0100
    Re: [Xen-devel] [PATCH] xen: fix potential integer overflow in queue_reply David Vrabel <david.vrabel@citrix.com> - 2016-01-18 17:50 +0100

csiph-web