Skip to content

Commit 380b27e

Browse files
committed
Fix UARTSerial emergency unbuffered write
The length calculation in UARTSerial::write_unbuffered was wrong, meaning it would truncate output data to half length. This would show up if `platform.stdio-buffered-serial` was configured to true, `platform.stdio-convert-newlines` was still false - `mbed_error` crashes would be garbled. This wasn't usually spotted because applications generally have both settings false or both true, and if newline conversion is on, then `mbed_error_puts` writes 1 character at a time to FileHandle::write, avoiding the length error.
1 parent 71c84e8 commit 380b27e

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/UARTSerial.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ ssize_t UARTSerial::write_unbuffered(const char *buf_ptr, size_t length)
147147

148148
for (size_t data_written = 0; data_written < length; data_written++) {
149149
SerialBase::_base_putc(*buf_ptr++);
150-
data_written++;
151150
}
152151

153152
return length;

0 commit comments

Comments
 (0)