Hardened the checking of directory offset requested by a readdir

When asked for the next directory entries, make sure the chunk offset
is within valid values, otherwise return no more entries in chunk.
pull/40/head
Jean-Pierre André 2022-05-10 10:48:18 +02:00
parent 7f81935f32
commit fb28eef6f1
1 changed files with 1 additions and 1 deletions

View File

@ -2223,7 +2223,7 @@ static void fuse_lib_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
}
}
if (dh->filled) {
if (off < dh->len) {
if ((off >= 0) && (off < dh->len)) {
if (off + size > dh->len)
size = dh->len - off;
} else