From: Ian Jackson Subject: Re: [PATCH 09/16] libelf: check nul-terminated strings properly Date: Tue, 4 Jun 2013 18:13:07 +0100 Message-ID: <20910.8227.19830.815515@mariner.uk.xensource.com> References: <1370274111-18377-1-git-send-email-ian.jackson@eu.citrix.com> <1370274111-18377-10-git-send-email-ian.jackson@eu.citrix.com> <20910.1144.651512.485359@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Matthew Daley Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Matthew Daley writes ("Re: [PATCH 09/16] libelf: check nul-terminated strings properly"): > I think I screwed up my explanation. I meant, if the user-supplied end > address of the note section is way off base - outside of the actual > image - elf_note_next will eventually read out-of-range 0s for the two > note sizes, and return a out-of-range handle note just past the last > one. elf_note_name will return NULL on this out-of-range note handle, > and the loop continues - maybe for up to ~0ul / 12 'notes'. Oh I see. I think I should fix this by having elf_note_next check that the returned value is in range and return ELF_MAX_PTRVAL if it isn't. > I agree with the O(n^2) problem too, though. This was a bit of a can of worms... Ian.