From 954e5a2d029e1e13680941e7f2879a689c0f5faf Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Mon, 25 Mar 2024 22:30:59 +0200 Subject: [PATCH] Fix linux_stat --- syscalls/linux.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/syscalls/linux.cpp b/syscalls/linux.cpp index 7d6b3b2..3078be0 100644 --- a/syscalls/linux.cpp +++ b/syscalls/linux.cpp @@ -150,7 +150,11 @@ static int linux_stat(SysFrm *, const char *pathname, struct stat *statbuf) if (pPathname == nullptr) return -EFAULT; - return fdt->_stat(pPathname, statbuf); + auto pStatbuf = vma->UserCheckAndGetAddress(statbuf); + if (pStatbuf == nullptr) + return -EFAULT; + + return fdt->_stat(pPathname, pStatbuf); } /* https://man7.org/linux/man-pages/man2/fstat.2.html */