libio: Check remaining buffer size in _IO_wdo_write (bug 31183)
commitecc7c3deb9f347649c2078fcc0f94d4cedf92d60
authorFlorian Weimer <fweimer@redhat.com>
Tue, 2 Jan 2024 13:36:17 +0000 (2 14:36 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 2 Jan 2024 13:36:17 +0000 (2 14:36 +0100)
treeabe55d643161698f999e9c95e0fbec43d140ce44
parent5eabdb6a6ac1599d23dd5966a37417215950245f
libio: Check remaining buffer size in _IO_wdo_write (bug 31183)

The multibyte character needs to fit into the remaining buffer space,
not the already-written buffer space.  Without the fix, we were never
moving the write pointer from the start of the buffer, always using
the single-character fallback buffer.

Fixes commit 04b76b5aa8b2d1d19066e42dd1 ("Don't error out writing
a multibyte character to an unbuffered stream (bug 17522)").
libio/wfileops.c