diff options
| author | Rich Felker <dalias@aerifal.cx> | 2026-05-05 19:49:32 -0400 |
|---|---|---|
| committer | Rich Felker <dalias@aerifal.cx> | 2026-05-05 19:49:32 -0400 |
| commit | bb4b4102461acfbf77da759ca3a6deb555f3da3b (patch) | |
| tree | 99868278002504cb10195c19a4b3af1e12a55ea7 /src | |
| parent | 9086784bf2d883b68dabf78a68164e3c71cff206 (diff) | |
| download | musl-bb4b4102461acfbf77da759ca3a6deb555f3da3b.tar.gz | |
fix fmemopen write-mode streams clobbering final byte with null
commit d2e061a2bd3f7674cfef2e2217e0695419041b5e wrongly added this
case based on a misreading of the standard text regarding null
termination in write/update modes. apparently, the condition "if it
fits" was interpreted as only applying to update modes, despite the
words "or for writing only" appearing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/stdio/fmemopen.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/stdio/fmemopen.c b/src/stdio/fmemopen.c index 04472247..38ba9f85 100644 --- a/src/stdio/fmemopen.c +++ b/src/stdio/fmemopen.c @@ -74,7 +74,6 @@ static size_t mwrite(FILE *f, const unsigned char *buf, size_t len) if (c->pos > c->len) { c->len = c->pos; if (c->len < c->size) c->buf[c->len] = 0; - else if ((f->flags&F_NORD) && c->size) c->buf[c->size-1] = 0; } return len; } |
