aboutgitcodebugslistschat
path: root/pasta.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-01-26 06:40:53 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-01-26 16:30:59 +0100
commit34872fadec608a6305ab9bcdd15592282cb194a5 (patch)
tree2515578e202733c66507ff5131b884b574eb2b0f /pasta.c
parent64f7d81d9ae4fd7e6bd21a3e0a1ce3d3d0250bec (diff)
downloadpasst-34872fadec608a6305ab9bcdd15592282cb194a5.tar
passt-34872fadec608a6305ab9bcdd15592282cb194a5.tar.gz
passt-34872fadec608a6305ab9bcdd15592282cb194a5.tar.bz2
passt-34872fadec608a6305ab9bcdd15592282cb194a5.tar.lz
passt-34872fadec608a6305ab9bcdd15592282cb194a5.tar.xz
passt-34872fadec608a6305ab9bcdd15592282cb194a5.tar.zst
passt-34872fadec608a6305ab9bcdd15592282cb194a5.zip
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>
Diffstat (limited to 'pasta.c')
-rw-r--r--pasta.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pasta.c b/pasta.c
index bcc1261..3928ad0 100644
--- a/pasta.c
+++ b/pasta.c
@@ -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;