Fangrui Song 67e0f410ff
[dfsan] Make sprintf interceptor compatible with glibc 2.37+ and musl (#78363)
snprintf interceptors call `format_buffer` with `size==~0ul`, which
may eventually lead to `snprintf(s, n, "Hello world!")` where `s+n`
wraps around. Since glibc 2.37 (https://sourceware.org/PR30441), the
snprintf call does not write the last char. musl snprintf returns -1
with EOVERFLOW when `n > INT_MAX`.

Change `size` to INT_MAX to work with glibc 2.37+ and musl.
snprintf interceptors are not changed. It's user responsibility to not
cause a compatibility issue with libc implementations.

Fix #60678
2024-01-17 17:14:31 -08:00
..
2023-01-03 13:17:39 -08:00