Browse Source

Merge pull request #3628 from wavexx/lcd_pad_fix

lcd_print_pad: do not overflow len when truncating the string
Yuri D'Elia 1 year ago
parent
commit
4434d120c8
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Firmware/lcd.cpp

+ 4 - 1
Firmware/lcd.cpp

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