1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-04 18:03:20 +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 8559c8bbb1
commit f11c65e9a7
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;
}
if(addr == freeSpaceStart) {
// check for valid first magic byte
if(*((uint8 *) buffer.get()) != 0xE9) {
return false;
}
}
noInterrupts();
rc = SPIWrite(addr, buffer.get(), willRead);
interrupts();

View File

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