Przeglądaj źródła

fix: avoid buffer overflow in sam engine if index == 255

It may be 255, according to the if above the patch, but flags has 81
items.
leha-bot 1 rok temu
rodzic
commit
66995c1bc1
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      sam/stm32_sam.cpp

+ 2 - 2
sam/stm32_sam.cpp

@@ -4510,7 +4510,7 @@ void STM32SAM::AdjustLengths() {
                 mem56 = flags[index];
 
             // not a consonant
-            if((flags[index] & 64) == 0) {
+            if((index != 255 && flags[index] & 64) == 0) {
                 // RX or LX?
                 if((index == 18) || (index == 19)) // 'RX' & 'LX'
                 {
@@ -5700,4 +5700,4 @@ inline void STM32SAM::SetAUDIO(unsigned char main_volume) {
     }
 
     LL_TIM_OC_SetCompareCH1(FURI_HAL_SPEAKER_TIMER, data);
-}
+}