Skip to content

Commit 625dfe4

Browse files
fixup! defining OTAInterface
1 parent f5895d8 commit 625dfe4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ota/interface/OTAInterfaceDefault.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ OTACloudProcessInterface::State OTADefaultCloudProcessInterface::fetch() {
104104
goto exit;
105105
}
106106

107-
parseOta(context->buffer, context->buf_len);
107+
parseOta(context->buffer, http_res);
108108

109109
// TODO verify that the information present in the ota header match the info in context
110110
if(context->downloadState == OtaDownloadCompleted) {
@@ -190,6 +190,10 @@ void OTADefaultCloudProcessInterface::parseOta(uint8_t* buffer, size_t buf_len)
190190
if(context->downloadedSize == http_client->contentLength()) {
191191
context->downloadState = OtaDownloadCompleted;
192192
}
193+
194+
if(context->downloadedSize > http_client->contentLength()) {
195+
context->downloadState = OtaDownloadError;
196+
}
193197
// TODO fail if we exceed a timeout? and available is 0 (client is broken)
194198
break;
195199
case OtaDownloadCompleted:

0 commit comments

Comments
 (0)