diff options
author | Rich Felker <dalias@aerifal.cx> | 2016-10-21 20:57:15 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-10-21 22:15:31 -0400 |
commit | ed8696742504b6182954254e78ec123c8bcd8d3b (patch) | |
tree | c48f0867c50e5c1ef2b0104d3d63d675fa29c22c /include/link.h | |
parent | 7597fc25a2743d49500926a286da71f8e033936c (diff) | |
download | musl-ed8696742504b6182954254e78ec123c8bcd8d3b.tar.gz musl-ed8696742504b6182954254e78ec123c8bcd8d3b.tar.xz musl-ed8696742504b6182954254e78ec123c8bcd8d3b.zip |
redesign snprintf without undefined behavior
the old snprintf design setup the FILE buffer pointers to point directly into the destination buffer; if n was actually larger than the buffer size, the pointer arithmetic to compute the buffer end pointer was undefined. this affected sprintf, which is implemented in terms of snprintf, as well as some unusual but valid direct uses of snprintf. instead, setup the FILE as unbuffered and have its write function memcpy to the destination. the printf core sets up its own temporary buffer for unbuffered streams.
Diffstat (limited to 'include/link.h')
0 files changed, 0 insertions, 0 deletions