Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

fix stack overflow on tembed by allocating ir sq on heap

Geo03ac04026fcc
diff --git a/src/Services/InfraredService.cpp b/src/Services/InfraredService.cpp
index 8a9200b9..62e4cea4 100644
--- a/src/Services/InfraredService.cpp
+++ b/src/Services/InfraredService.cpp
@@ -56,14 +56,15 @@ void InfraredService::sendInfraredCommand(InfraredCommand command) {
int frequency = 38; // Default frequency, passed by reference to encodeRemoteCommand
std::vector<float> sequence = encodeRemoteCommand(command, protocolString.c_str(), frequency);
- // Convert the sequence to uint16_t format as required by sendRaw
- uint16_t raw[sequence.size()];
+ // Convert for sendRaw
+ uint16_t* raw = new uint16_t[sequence.size()];
for (size_t i = 0; i < sequence.size(); ++i) {
raw[i] = static_cast<uint16_t>(sequence[i]);
}
-
+
// Send the raw generated sequence with the correct frequency
IrSender.sendRaw(raw, sequence.size(), frequency);
+ delete[] raw;
}
}
}
diff --git a/src/Vendors/MakeHex.cpp b/src/Vendors/MakeHex.cpp
index 0d02c1de..709fd563 100644
--- a/src/Vendors/MakeHex.cpp
+++ b/src/Vendors/MakeHex.cpp
@@ -109,12 +109,13 @@ std::vector<float> encodeRemoteCommand(const InfraredCommand& cmd, const char* p
// Generate IR sequence
int s, r;
- float seq[256];
+ float* seq = new float[256];
Irp.generate(&s, &r, seq);
// Convert to vector for easier handling
std::vector<float> result(seq, seq + 2 * (s + r));
-
+ delete[] seq;
+
return result;
}