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:
Beat Küng 2017-07-21 17:10:55 +02:00 committed by Lorenz Meier
parent 5a2723ab9c
commit 29f23a390f

View File

@ -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;