mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
fix writes outside buffer by ungetc after setvbuf
commit 0b80a7b040
, which added non-stub
setvbuf, applied the UNGET pushback adjustment to the size of the
buffer passed in, but inadvertently omitted offsetting the start by
the same amount, thereby allowing unget to clobber up to 8 bytes
before the start of the buffer. this bug was introduced in the present
release cycle; no releases are affected.
This commit is contained in:
parent
062015204a
commit
9cad27a3dc
1 changed files with 1 additions and 1 deletions
|
@ -14,7 +14,7 @@ int setvbuf(FILE *restrict f, char *restrict buf, int type, size_t size)
|
|||
f->buf_size = 0;
|
||||
} else {
|
||||
if (buf && size >= UNGET) {
|
||||
f->buf = (void *)buf;
|
||||
f->buf = (void *)(buf + UNGET);
|
||||
f->buf_size = size - UNGET;
|
||||
}
|
||||
if (type == _IOLBF && f->buf_size)
|
||||
|
|
Loading…
Add table
Reference in a new issue