diff --git a/src/modules/mavlink/mavlink_ftp.cpp b/src/modules/mavlink/mavlink_ftp.cpp index a376392c00..058e9d95f1 100644 --- a/src/modules/mavlink/mavlink_ftp.cpp +++ b/src/modules/mavlink/mavlink_ftp.cpp @@ -1160,7 +1160,7 @@ bool MavlinkFTP::_validatePathIsWritable(const char *path) // Don't allow writes to system paths as they are in RAM // Ideally we'd canonicalize the path (with 'realpath'), but it might not exist, so realpath() would fail. // The next simpler thing is to check there's no reference to a parent dir. - if (strncmp(path, "/fs/microsd/", 12) != 0 || strstr(path, "/../") != nullptr) { + if (strncmp(path, CONFIG_BOARD_ROOT_PATH "/", 12) != 0 || strstr(path, "/../") != nullptr) { PX4_ERR("Disallowing write to %s", path); return false; } diff --git a/src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp b/src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp index 288023a650..2accd21c54 100644 --- a/src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp +++ b/src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp @@ -43,7 +43,7 @@ #include "../mavlink_ftp.h" #ifdef __PX4_NUTTX -#define PX4_MAVLINK_TEST_DATA_DIR "/fs/microsd/ftp_unit_test_data" +#define PX4_MAVLINK_TEST_DATA_DIR CONFIG_BOARD_ROOT_PATH "/ftp_unit_test_data" #else #define PX4_MAVLINK_TEST_DATA_DIR "ftp_unit_test_data" #endif