[PATCH] libio: Avoid _allocate_buffer, _free_buffer pointers [BZ #23236]

Carlos O'Donell carlos@redhat.com
Wed May 30 16:43:00 GMT 2018


On 05/30/2018 12:40 PM, Florian Weimer wrote:
> On 05/30/2018 06:36 PM, Carlos O'Donell wrote:
>>> -  new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc; -
>>> new_f->fp._sf._s._free_buffer = (_IO_free_type) free; +
>>> new_f->fp._sf._s._allocate_buffer_unused = (_IO_alloc_type)
>>> malloc; +  new_f->fp._sf._s._free_buffer_unused = (_IO_free_type)
>>> free;
>> Do we have to assign malloc/free to these? Why not just a static
>> value of '1'? It would make it more clear that they are unused and
>> crash. Or is it possible that they could get used by legacy code?
> 
> Yes, it is possible that they are used from 90s libstdc++ and similar
> code.  Having valid function pointers there helps with compatibility,
> I think.

OK, looks good to me then. Thanks for the hardening work.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>



More information about the Libc-alpha mailing list