diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-01-26 06:40:53 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-01-26 16:30:59 +0100 |
commit | 34872fadec608a6305ab9bcdd15592282cb194a5 (patch) | |
tree | 2515578e202733c66507ff5131b884b574eb2b0f /pasta.c | |
parent | 64f7d81d9ae4fd7e6bd21a3e0a1ce3d3d0250bec (diff) | |
download | passt-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; |