diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-02-11 20:48:14 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-02-11 20:48:14 -0500 |
commit | 75cba9c67fde03421b96c1bcbaf666b4b348739d (patch) | |
tree | d25bf4c2b0e4fe5e357ec51d5621988a1f675dfc /arch/or1k/atomic_arch.h | |
parent | 249b621f9efeb8c47f34b698875c54c9c3108df3 (diff) | |
download | musl-75cba9c67fde03421b96c1bcbaf666b4b348739d.tar.gz |
fix incorrect overflow check for allocation in fmemopen
when a null buffer pointer is passed to fmemopen, requesting it
allocate its own memory buffer, extremely large size arguments near
SIZE_MAX could overflow and result in underallocation. this results
from omission of the size of the cookie structure in the overflow
check but inclusion of it in the calloc call.
instead of accounting for individual small contributions to the total
allocation size needed, simply reject sizes larger than PTRDIFF_MAX,
which will necessarily fail anyway. then adding arbitrary fixed-size
structures is safe without matching up the expressions in the
comparison and the allocation.
Diffstat (limited to 'arch/or1k/atomic_arch.h')
0 files changed, 0 insertions, 0 deletions