mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-03-23 18:13:49 +08:00
fix(mavlink): correct session validation in FTP write and burst operations
Use logical OR (||) instead of AND (&&) in _workWrite() and _workBurst() session validation, matching the correct logic already used in _workRead() and _workTerminate(). The AND operator allowed operations to proceed with an invalid session ID as long as a valid file descriptor existed. Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
@@ -566,7 +566,7 @@ MavlinkFTP::_workRead(PayloadHeader *payload)
|
||||
MavlinkFTP::ErrorCode
|
||||
MavlinkFTP::_workBurst(PayloadHeader *payload, uint8_t target_system_id, uint8_t target_component_id)
|
||||
{
|
||||
if (payload->session != 0 && _session_info.fd < 0) {
|
||||
if (payload->session != 0 || _session_info.fd < 0) {
|
||||
PX4_DEBUG("_workBurst: no session or no fd");
|
||||
return kErrInvalidSession;
|
||||
}
|
||||
@@ -587,7 +587,7 @@ MavlinkFTP::_workBurst(PayloadHeader *payload, uint8_t target_system_id, uint8_t
|
||||
MavlinkFTP::ErrorCode
|
||||
MavlinkFTP::_workWrite(PayloadHeader *payload)
|
||||
{
|
||||
if (payload->session != 0 && _session_info.fd < 0) {
|
||||
if (payload->session != 0 || _session_info.fd < 0) {
|
||||
PX4_DEBUG("_workWrite: no session or no fd");
|
||||
return kErrInvalidSession;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user