Skip to content

Commit

Permalink
array index is oor #451
Browse files Browse the repository at this point in the history
  • Loading branch information
schreibfaul1 committed Jun 11, 2024
1 parent 938aee3 commit 218d600
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// created: 10.Feb.2022
// updated: 10.Jun 2024
// updated: 11.Jun 2024

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

//————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

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

m_itemListPos -= 2;

if(*m_dlnaLevel == 0){
Expand All @@ -1789,7 +1792,7 @@ class dlnaList{
}

if(maybe_a_file){
if(startsWith(m_srvContent.itemURL[m_itemListPos - 1], "http")){
if(startsWith(m_srvContent.itemURL[m_itemListPos], "http")){
log_i("long pressed at file %s", m_srvContent.itemURL[m_itemListPos]);
goto exit;
}
Expand Down
7 changes: 4 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,8 +1554,8 @@ void setup() {

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

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

Expand Down Expand Up @@ -2404,7 +2404,7 @@ void loop() {
ir.loop();
tp.loop();
ftpSrv.handleFTP();
ArduinoOTA.handle();
// ArduinoOTA.handle();
dlna.loop();
bt_emitter.loop();

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

0 comments on commit 218d600

Please sign in to comment.