mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 22:51:35 +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:
@@ -311,7 +311,8 @@ MavlinkFTP::_workList(PayloadHeader *payload, bool list_hidden)
|
|||||||
struct dirent *result = nullptr;
|
struct dirent *result = nullptr;
|
||||||
|
|
||||||
// move to the requested offset
|
// move to the requested offset
|
||||||
seekdir(dp, payload->offset);
|
int requested_offset = payload->offset;
|
||||||
|
while (requested_offset-- > 0 && readdir(dp));
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user