Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
Diff: common/RawSerial.cpp
- Revision:
- 47:e32b5dd8af6d
- Parent:
- 0:9b334a45a8ff
diff -r cb4f85f96d35 -r e32b5dd8af6d common/RawSerial.cpp --- a/common/RawSerial.cpp Mon Jan 11 09:45:10 2016 +0000 +++ b/common/RawSerial.cpp Mon Jan 11 17:00:10 2016 +0000 @@ -47,7 +47,10 @@ int RawSerial::printf(const char *format, ...) { std::va_list arg; va_start(arg, format); - int len = vsnprintf(NULL, 0, format, arg); + // ARMCC microlib does not properly handle a size of 0. + // As a workaround supply a dummy buffer with a size of 1. + char dummy_buf[1]; + int len = vsnprintf(dummy_buf, sizeof(dummy_buf), format, arg); if (len < STRING_STACK_LIMIT) { char temp[STRING_STACK_LIMIT]; vsprintf(temp, format, arg);