freebsd-src icon indicating copy to clipboard operation
freebsd-src copied to clipboard

libc/stdio: Increase BUF in vfprintf.c and vfwprintf.c

Open VexedUXR opened this issue 1 year ago • 1 comments

With the new %b format specifier, we need at most 64 characters.

Also, the comment says that we need enough space to write a uintmax_t in octal plus one byte, I'm not sure what that's for. I guess its implying that we need a null terminator(?), but it doesn't look like we do.

This can be easily tested by doing:

printf("%lb\n", 1ul << n); /* Where n is anywhere from 32 to 63 */

VexedUXR avatar Aug 31 '24 04:08 VexedUXR

Thinking about this some more, we should just be able to remove the whole conditional and make BUF sizeof(uintmax_t) * CHAR_BIT

VexedUXR avatar Sep 01 '24 18:09 VexedUXR