1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-23 19:21:59 +03:00

add basic check for valid data for in updateSketch (first byte of bin is always 0xE9)

send SDK version by HTTP Update
This commit is contained in:
Markus Sattler
2015-06-22 10:23:33 +02:00
parent 44a96b253c
commit c0e5b54073
2 changed files with 10 additions and 0 deletions

View File

@ -414,6 +414,13 @@ bool EspClass::updateSketch(Stream& in, uint32_t size) {
return false; return false;
} }
if(addr == freeSpaceStart) {
// check for valid first magic byte
if(*((uint8 *) buffer.get()) != 0xE9) {
return false;
}
}
noInterrupts(); noInterrupts();
rc = SPIWrite(addr, buffer.get(), willRead); rc = SPIWrite(addr, buffer.get(), willRead);
interrupts(); interrupts();

View File

@ -72,6 +72,9 @@ t_httpUpdate_return ESP8266HTTPUpdate::update(const char *host, uint16_t port, c
req += "\r\n" req += "\r\n"
"x-ESP8266-chip-size: "; "x-ESP8266-chip-size: ";
req += ESP.getFlashChipRealSize(); req += ESP.getFlashChipRealSize();
req += "\r\n"
"x-ESP8266-sdk-version: ";
req += ESP.getSdkVersion();
if(current_version[0] != 0x00) { if(current_version[0] != 0x00) {
req += "\r\n" req += "\r\n"