mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-27 23:04:07 +08:00
mavlink_ftp: avoid using seekdir()
The provided argument payload->offset is in range [0, num_file_entries-1], but seekdir might use a completely different range. It is not defined by the API spec. It is only useful in conjunction with telldir().
This commit is contained in:
parent
5a2723ab9c
commit
29f23a390f
@ -311,7 +311,8 @@ MavlinkFTP::_workList(PayloadHeader *payload, bool list_hidden)
|
||||
struct dirent *result = nullptr;
|
||||
|
||||
// move to the requested offset
|
||||
seekdir(dp, payload->offset);
|
||||
int requested_offset = payload->offset;
|
||||
while (requested_offset-- > 0 && readdir(dp));
|
||||
|
||||
for (;;) {
|
||||
errno = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user