1
0
mirror of https://passt.top/passt synced 2024-06-23 11:37:04 +00:00

pasta: Check for zero d_reclen returned by getdents64() syscall

Seen on PPC with some older kernel versions: we seemingly have bytes
left to read from the returned array of dirent structs, but d_reclen
is zero: this, and all the subsequent entries, are not valid.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-01-26 06:40:53 +01:00
parent 64f7d81d9a
commit 34872fadec

View File

@ -63,7 +63,7 @@ loop:
struct dirent *dp = (struct dirent *)buf;
int pos = 0;
while (pos < n) {
while (dp->d_reclen && pos < n) {
pid_t pid;
errno = 0;