Browse Source

ensure user isn't removing invalid path

pull/377/head
liamcottle 1 year ago
parent
commit
9d574b2de0
  1. 7
      examples/companion_radio/MyMesh.cpp

7
examples/companion_radio/MyMesh.cpp

@ -1358,6 +1358,11 @@ void MyMesh::checkCLIRescueCmd() {
// get path from command e.g: "rm /adv_blobs" // get path from command e.g: "rm /adv_blobs"
const char *path = &cli_command[4]; const char *path = &cli_command[4];
// ensure path is not empty, or root dir
if(!path || strlen(path) == 0 || strcmp(path, "/") == 0){
Serial.println("Invalid path provided");
} else {
// remove file // remove file
bool removed = _store->removeFile(path); bool removed = _store->removeFile(path);
if(removed){ if(removed){
@ -1366,6 +1371,8 @@ void MyMesh::checkCLIRescueCmd() {
Serial.println("Failed to remove file"); Serial.println("Failed to remove file");
} }
}
} else if (strcmp(cli_command, "reboot") == 0) { } else if (strcmp(cli_command, "reboot") == 0) {
board.reboot(); // doesn't return board.reboot(); // doesn't return
} else { } else {

Loading…
Cancel
Save