musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/include/sys/time.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016年10月21日 20:57:15 -0400
committerRich Felker <dalias@aerifal.cx>2016年10月21日 22:15:31 -0400
commited8696742504b6182954254e78ec123c8bcd8d3b (patch)
treec48f0867c50e5c1ef2b0104d3d63d675fa29c22c /include/sys/time.h
parent7597fc25a2743d49500926a286da71f8e033936c (diff)
downloadmusl-ed8696742504b6182954254e78ec123c8bcd8d3b.tar.gz
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/sys/time.h')
0 files changed, 0 insertions, 0 deletions
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月08日 06:37:17 +0000

AltStyle によって変換されたページ (->オリジナル) /