Merge pull request #3628 from wavexx/lcd_pad_fix

lcd_print_pad: do not overflow len when truncating the string
This commit is contained in:
Yuri D'Elia 2022-09-26 11:58:00 +02:00 committed by GitHub
commit 4434d120c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

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);
}