mbed library sources. Supersedes mbed-src.
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);