[PATCH v2] stdlib: realpath use malloc replace __alloca to reduce stack overflow risks [BZ #26341]
Florian Weimer
fw@deneb.enyo.de
Sun Aug 9 12:38:06 GMT 2020
* Paul Eggert:
> On 8/8/20 1:54 AM, Xiaoming Ni wrote:
>> To avoid possible stack overflow risks (the remaining stack space is uncertain
>> when realpath is called), should we sacrifice some efficiency and reduce the
>> stack space usage? Use malloc instead of alloca (4k+4k).
>
> 8 KiB of stack in a non-recursive I/O routine is not that big a deal. I don't
> see why we would need to worry about that.
I have seen a report that the temporary buffer in vfprintf on an
unbuffered stream causes crashes because after a hardware upgrade, the
available stack space was insufficient. That on-stack buffer is 8 KiB
as well.
More information about the Libc-alpha
mailing list