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 af37520 commit 88f9078Copy full SHA for 88f9078
platform/mbed_retarget.cpp
@@ -827,11 +827,10 @@ void mbed_set_unbuffered_stream(std::FILE *_file) {
827
std::FILE *mbed_fdopen(FileHandle *fh, const char *mode)
828
{
829
// This is to avoid scanf(buf, ":%.4s", fh) and the bloat it brings.
830
- char buf[2 + sizeof(fh) + 1]; /* :(pointer) + null byte */
831
- MBED_STATIC_ASSERT(sizeof(buf) == 7, "Pointers should be 4 bytes.");
+ char buf[1 + sizeof(fh)]; /* :(pointer) */
+ MBED_STATIC_ASSERT(sizeof(buf) == 5, "Pointers should be 4 bytes.");
832
buf[0] = ':';
833
memcpy(buf + 1, &fh, sizeof(fh));
834
- buf[1 + sizeof(fh)] = '\0';
835
836
std::FILE *stream = std::fopen(buf, mode);
837
/* newlib-nano doesn't appear to ever call _isatty itself, so
0 commit comments