[PATCH v2] vfprintf stack overflow [BZ #16617]

Joseph Myers joseph@codesourcery.com
Mon Dec 8 15:41:00 GMT 2014


On Mon, 8 Dec 2014, Florian Weimer wrote:

> +		specs = malloc (nspecs_size);
> +		if (specs == NULL)
> +		  {
> +		    __set_errno (ENOMEM);
> +		    done = -1;
> +		    goto all_done;
> +		  }

It looks to me like this will leak the previous copy of specs on 
allocation failure, if the previous value was also malloced (so you need 
"specs = old;" or similar here to get the return path to free it if 
appropriate).

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list