Skip to content

Commit 218d600

Browse files
committed
array index is oor #451
1 parent 938aee3 commit 218d600

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/common.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// created: 10.Feb.2022
2-
// updated: 10.Jun 2024
2+
// updated: 11.Jun 2024
33

44
#pragma once
55
#pragma GCC optimize("Os") // optimize for code size
@@ -21,13 +21,13 @@
2121
#define SDMMC_FREQUENCY 80000000 // 80000000 or 40000000 MHz
2222
#define FTP_USERNAME "esp32" // user and pw in FTP Client
2323
#define FTP_PASSWORD "esp32"
24-
#define CONN_TIMEOUT 1000 // unencrypted connection timeout in ms (http://...)
24+
#define CONN_TIMEOUT 1000 // unencrypted connection timeout in ms (http://...)
2525
#define CONN_TIMEOUT_SSL 2500 // encrypted connection timeout in ms (https://...)
2626

2727
//————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
2828

2929
#include <Arduino.h>
30-
#include <ArduinoOTA.h>
30+
// #include <ArduinoOTA.h>
3131
#include <Preferences.h>
3232
#include <Ticker.h>
3333
#include <SPI.h>
@@ -1772,7 +1772,10 @@ class dlnaList{
17721772
bool maybe_a_folder = false;
17731773
m_clicked = false; // ignore tp released event, wait of next clicked
17741774
m_itemListPos = (y / (m_h / 10));
1775-
if(m_itemListPos < 2 || m_itemListPos > 11) goto exit; // oor, is header, footer or return item
1775+
if(m_itemListPos == 0) goto exit; // is header
1776+
if(m_itemListPos == 1) {log_i("long pressed at return item %s", m_dlnaHistory[*m_dlnaLevel].name); goto exit;}
1777+
if(m_itemListPos >= 11) goto exit; // is footer
1778+
17761779
m_itemListPos -= 2;
17771780

17781781
if(*m_dlnaLevel == 0){
@@ -1789,7 +1792,7 @@ class dlnaList{
17891792
}
17901793

17911794
if(maybe_a_file){
1792-
if(startsWith(m_srvContent.itemURL[m_itemListPos - 1], "http")){
1795+
if(startsWith(m_srvContent.itemURL[m_itemListPos], "http")){
17931796
log_i("long pressed at file %s", m_srvContent.itemURL[m_itemListPos]);
17941797
goto exit;
17951798
}

src/main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,8 @@ void setup() {
15541554

15551555
strcpy(_myIP, WiFi.localIP().toString().c_str());
15561556
SerialPrintfln("setup: .... connected to " ANSI_ESC_CYAN "%s" ANSI_ESC_WHITE ", IP address is " ANSI_ESC_CYAN "%s", WiFi.SSID().c_str(), _myIP);
1557-
ArduinoOTA.setHostname("MiniWebRadio");
1558-
ArduinoOTA.begin();
1557+
// ArduinoOTA.setHostname("MiniWebRadio");
1558+
// ArduinoOTA.begin();
15591559

15601560
ftpSrv.begin(SD_MMC, FTP_USERNAME, FTP_PASSWORD); // username, password for ftp.
15611561

@@ -2404,7 +2404,7 @@ void loop() {
24042404
ir.loop();
24052405
tp.loop();
24062406
ftpSrv.handleFTP();
2407-
ArduinoOTA.handle();
2407+
// ArduinoOTA.handle();
24082408
dlna.loop();
24092409
bt_emitter.loop();
24102410

@@ -2704,6 +2704,7 @@ void audio_info(const char* info) {
27042704
log_w("disconnected, wait 35s");
27052705
vTaskDelay(35000 / portTICK_PERIOD_MS);
27062706
log_w("try reconnection");
2707+
_reconnectCnt = 0;
27072708
_f_reconnect = true;
27082709
}return;}
27092710
if(startsWith(info, "FLAC")) {SerialPrintflnCut("AUDIO_info: ", ANSI_ESC_GREEN, info); return;}

0 commit comments

Comments
 (0)