From 170c1cbfa0b034848616935d48ac8250bd831ad0 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Thu, 26 Feb 2026 21:19:39 -0600 Subject: [PATCH] Add extra checks in for file handle lookup --- src/dirinfo.hpp | 1 + src/fuse_ftruncate.cpp | 3 +++ src/fuse_futimens.cpp | 3 +++ 3 files changed, 7 insertions(+) diff --git a/src/dirinfo.hpp b/src/dirinfo.hpp index 8ae2315c..b48e7414 100644 --- a/src/dirinfo.hpp +++ b/src/dirinfo.hpp @@ -18,6 +18,7 @@ #pragma once +#include "assert.hpp" #include "fh.hpp" #include "base_types.h" diff --git a/src/fuse_ftruncate.cpp b/src/fuse_ftruncate.cpp index 46e02b73..677656fc 100644 --- a/src/fuse_ftruncate.cpp +++ b/src/fuse_ftruncate.cpp @@ -55,6 +55,9 @@ FUSE::ftruncate(const fuse_req_ctx_t *ctx_, }); } + if(fh == 0) + return -ENOENT; + FileInfo *fi = FileInfo::from_fh(fh); return ::_ftruncate(fi->fd,size_); diff --git a/src/fuse_futimens.cpp b/src/fuse_futimens.cpp index 9c94c231..40387dd6 100644 --- a/src/fuse_futimens.cpp +++ b/src/fuse_futimens.cpp @@ -57,6 +57,9 @@ FUSE::futimens(const fuse_req_ctx_t *ctx_, }); } + if(fh == 0) + return -ENOENT; + FileInfo *fi = FileInfo::from_fh(fh); return ::_futimens(fi->fd,ts_);