Privilege checks must run before bootloader init

This commit is contained in:
Will Tatam
2025-11-09 12:18:16 +00:00
parent 88466c7d1f
commit af8c851cc6

View File

@@ -548,11 +548,6 @@ void initServer()
}
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool isFinal){
if (index == 0) {
// Allocate the context structure
if (!initBootloaderOTA(request)) {
return; // Error will be dealt with after upload in response handler, above
}
// Privilege checks
IPAddress client = request->client()->remoteIP();
if (((otaSameSubnet && !inSameSubnet(client)) && !strlen(settingsPIN)) || (!otaSameSubnet && !inLocalSubnet(client))) {
@@ -571,6 +566,11 @@ void initServer()
setBootloaderOTAReplied(request);
return;
}
// Allocate the context structure
if (!initBootloaderOTA(request)) {
return; // Error will be dealt with after upload in response handler, above
}
}
handleBootloaderOTAData(request, index, data, len, isFinal);