Skip to content

Commit af8c851

Browse files
committed
Privilege checks must run before bootloader init
1 parent 88466c7 commit af8c851

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

wled00/wled_server.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,6 @@ void initServer()
548548
}
549549
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool isFinal){
550550
if (index == 0) {
551-
// Allocate the context structure
552-
if (!initBootloaderOTA(request)) {
553-
return; // Error will be dealt with after upload in response handler, above
554-
}
555-
556551
// Privilege checks
557552
IPAddress client = request->client()->remoteIP();
558553
if (((otaSameSubnet && !inSameSubnet(client)) && !strlen(settingsPIN)) || (!otaSameSubnet && !inLocalSubnet(client))) {
@@ -571,6 +566,11 @@ void initServer()
571566
setBootloaderOTAReplied(request);
572567
return;
573568
}
569+
570+
// Allocate the context structure
571+
if (!initBootloaderOTA(request)) {
572+
return; // Error will be dealt with after upload in response handler, above
573+
}
574574
}
575575

576576
handleBootloaderOTAData(request, index, data, len, isFinal);

0 commit comments

Comments
 (0)