diff --git a/Row.c b/Row.c index 9ea3f0731..3ee87cdbc 100644 --- a/Row.c +++ b/Row.c @@ -442,6 +442,10 @@ void Row_printLeftAlignedField(RichString* str, int attr, const char* content, u } int Row_printPercentage(float val, char* buffer, size_t n, uint8_t width, int* attr) { + assert(width >= 4 && width < n && "Invalid width in Row_printPercentage()"); + // truncate in favour of abort in xSnprintf() + width = (uint8_t)CLAMP(width, 4, n - 1); + if (isNonnegative(val)) { if (val < 0.05F) *attr = CRT_colors[PROCESS_SHADOW];