mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +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:
parent
1009268d31
commit
afd327b322
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user