We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3dae86e commit 208f19dCopy full SHA for 208f19d
newlib/libc/tinystdio/fmemopen.c
@@ -62,6 +62,13 @@ __fmem_put(char c, FILE *f)
62
mf->buf[mf->pos++] = c;
63
if (mf->pos > mf->size) {
64
mf->size = mf->pos;
65
+ /* When a stream open for update (the mode argument includes '+') or
66
+ * for writing only is successfully written and the write advances
67
+ * the current buffer end position, a null byte shall be written at
68
+ * the new buffer end position if it fits. */
69
+ if (mf->size < mf->bufsize) {
70
+ mf->buf[mf->size] = '\0';
71
+ }
72
}
73
return (unsigned char)c;
74
} else {
0 commit comments