Skip to content

Commit 63d0abf

Browse files
committed
fmemopen: when allocating the buffer write a NUL byte
This matches the behaviour from other libc implementations
1 parent 9c32d19 commit 63d0abf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

newlib/libc/tinystdio/fmemopen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ fmemopen(void *buf, size_t size, const char *mode)
151151
errno = ENOMEM;
152152
return NULL;
153153
}
154+
*((char *)buf) = '\0';
154155
mflags |= __MALL;
155156
}
156157

0 commit comments

Comments
 (0)