From: Ian Jackson Subject: Re: [PATCH 18/22] libxc: Add range checking to xc_dom_binloader Date: Tue, 11 Jun 2013 15:46:03 +0100 Message-ID: <20919.14379.251723.575507@mariner.uk.xensource.com> References: <1370629642-6990-1-git-send-email-ian.jackson@eu.citrix.com> <1370629642-6990-19-git-send-email-ian.jackson@eu.citrix.com> <51B64733.8010909@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51B64733.8010909@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: "xen-devel@lists.xensource.com" , "mattjd@gmail.com" , "security@xen.org" List-Id: xen-devel@lists.xenproject.org Andrew Cooper writes ("Re: [PATCH 18/22] libxc: Add range checking to xc_dom_binloader"): > On 07/06/13 19:27, Ian Jackson wrote: > > @@ -123,9 +123,12 @@ static struct xen_bin_image_table *find_table(struct xc_dom_image *dom) > > uint32_t *probe_ptr; > > uint32_t *probe_end; > > > > + if ( dom->kernel_size < sizeof(*table) ) > > + return NULL; > > probe_ptr = dom->kernel_blob; > > probe_end = dom->kernel_blob + dom->kernel_size - sizeof(*table); > > - if ( (void*)probe_end > (dom->kernel_blob + 8192) ) > > + if ( dom->kernel_size >= 8192 && > > + (void*)probe_end > (dom->kernel_blob + 8192) ) > > probe_end = dom->kernel_blob + 8192; > > More void pointer arithmetic. As discussed I intend to leave that alone. It has defined (and the desired) behaviour. > If I am reading the above correctly, it appears to be a glorified > > probe_end = dom->kernel_blob + (uintptr_t)min(dom->kernel_size - > sizeof(*table), 8192); > > which looks to be a more simple representation? Surely I shouldn't be changing this unnecessarily ? Ian.