diff --git a/firmware/util/loggingcentral.cpp b/firmware/util/loggingcentral.cpp index 925e7617c6..b13008be81 100644 --- a/firmware/util/loggingcentral.cpp +++ b/firmware/util/loggingcentral.cpp @@ -206,19 +206,21 @@ void efiPrintfInternal(const char *format, ...) { // Ensure that the string is comma-terminated in case it overflowed lineBuffer->buffer[sizeof(lineBuffer->buffer) - 1] = LOG_DELIMITER[0]; - if (len > sizeof(lineBuffer->buffer) - 1) + if (len > sizeof(lineBuffer->buffer) - 1) { len = sizeof(lineBuffer->buffer) - 1; + } + for (size_t i = 0; i < len; i++) { /* just replace all non-printable chars with space * TODO: is there any other "prohibited" chars? */ - if (isprint(lineBuffer->buffer[i]) == 0) + if (isprint(lineBuffer->buffer[i]) == 0) { lineBuffer->buffer[i] = ' '; + } } { // Push the buffer in to the written list so it can be written back chibios_rt::CriticalSectionLocker csl; - filledBuffers.postI(lineBuffer); } #endif