lcd_print_pad: do not overflow len when truncating the string

This commit is contained in:
Yuri D'Elia 2022-09-26 11:26:10 +02:00 committed by DRracer
parent 6bee4fec8d
commit aa721cafd9

View File

@ -530,7 +530,10 @@ void lcd_print(const char* s)
void lcd_print_pad(const char* s, uint8_t len)
{
while (len-- && *s) lcd_write(*(s++));
while (len && *s) {
lcd_write(*(s++));
--len;
}
lcd_space(len);
}