Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 4 Jul 2017 17:11:41 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] fix undefined behavior in free

On Tue, Jun 27, 2017 at 08:58:47PM +0300, Alexander Monakov wrote:
> ---
>  src/malloc/malloc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/malloc/malloc.c b/src/malloc/malloc.c
> index 720fa696..ef4c7368 100644
> --- a/src/malloc/malloc.c
> +++ b/src/malloc/malloc.c
> @@ -463,14 +463,15 @@ copy_realloc:
>  
>  void free(void *p)
>  {
> -	struct chunk *self = MEM_TO_CHUNK(p);
> -	struct chunk *next;
> +	struct chunk *self, *next;
>  	size_t final_size, new_size, size;
>  	int reclaim=0;
>  	int i;
>  
>  	if (!p) return;
>  
> +	self = MEM_TO_CHUNK(p);
> +
>  	if (IS_MMAPPED(self)) {
>  		size_t extra = self->psize;
>  		char *base = (char *)self - extra;
> -- 
> 2.11.0

Thanks, applied

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.