Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void ICACHE_FLASH_ATTR httpdRecvCb(ConnTypePtr rconn, char *remIp, int remPort,
conn->post->buff[conn->post->buffLen++]=data[x];
conn->post->received++;
conn->hostName=NULL;
if (conn->post->buffLen >= conn->post->buffSize || conn->post->received == conn->post->len) {
if (conn->post->buffLen >= conn->post->buffSize || (x+1) == len) {
//Received a chunk of post data
conn->post->buff[conn->post->buffLen]=0; //zero-terminate, in case the cgi handler knows it can use strings
//Process the data
Expand Down
11 changes: 5 additions & 6 deletions util/cgiflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ Some flash handling cgi routines. Used for updating the ESPFS/OTA image.

// Check that the header of the firmware blob looks like actual firmware...
static int ICACHE_FLASH_ATTR checkBinHeader(void *buf) {
uint8_t *cd = (uint8_t *)buf;
if (cd[0] != 0xEA) return 0;
if (cd[1] != 4 || cd[2] > 3 || cd[3] > 0x40) return 0;
if (((uint16_t *)buf)[3] != 0x4010) return 0;
if (((uint32_t *)buf)[2] != 0) return 0;
if (*buf != 0xEA) return 0;
if (*(buf + 1) != 4 || *(buf + 2) > 3 || *(buf + 3) > 0x60) return 0;
if (*(buf + 6) != 0x10 || *(buf + 7) != 0x40) return 0;
if (*(buf + 8) != 0 || *(buf + 9) != 0 || *(buf + 10) != 0 || *(buf + 11) != 0) return 0;
return 1;
}

Expand Down Expand Up @@ -299,4 +298,4 @@ int ICACHE_FLASH_ATTR cgiRebootFirmware(HttpdConnData *connData) {
return HTTPD_CGI_DONE;
}

#endif
#endif