hmm, need to re-check error handling

This commit is contained in:
Robin Müller 2023-07-04 16:55:40 +02:00
parent 7e1fb04f8a
commit 5c29635029
Signed by: muellerr
GPG Key ID: 407F9B00F858F270

View File

@ -58,7 +58,7 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, size_t maxCharPerL
#else
// General format: 0x01, 0x02, 0x03 so it is number of chars times 6
// plus line break plus small safety margin.
char printBuffer[(size + 1) * 7 + 1] = {};
char printBuffer[2048] = {};
size_t currentPos = 0;
for (size_t i = 0; i < size; i++) {
// To avoid buffer overflows.
@ -101,7 +101,7 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, size_t maxCharPerL
// General format: 32,243,-12 so it is number of chars times 4
// plus line break plus small safety margin.
uint16_t expectedLines = ceil((double)size / maxCharPerLine);
char printBuffer[size * 4 + 1 + expectedLines] = {};
char printBuffer[2048] = {};
size_t currentPos = 0;
for (size_t i = 0; i < size; i++) {
// To avoid buffer overflows.