diff options
author | Bernd Schubert <bschubert@ddn.com> | 2024-06-25 07:05:19 +0200 |
---|---|---|
committer | Bernd Schubert <bernd.schubert@fastmail.fm> | 2024-06-25 11:34:16 +0200 |
commit | f88e08f34d2d4f398f23797707e1c50cd306e405 (patch) | |
tree | 3caf402617d3eab28d814b9791e2bdd6bd35c755 /lib | |
parent | 09e6583b54b7cd126869d41908e28cd0e8f44e45 (diff) | |
download | libfuse-f88e08f34d2d4f398f23797707e1c50cd306e405.tar.gz |
Add nullptr check in fuse_session_mount
The pointer did not have any sanity check.
Addresses https://github.com/libfuse/libfuse/issues/979
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse_lowlevel.c | 5 | ||||
-rw-r--r-- | lib/mount_util.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 74b0424..8bfeb01 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -3256,6 +3256,11 @@ int fuse_session_mount(struct fuse_session *se, const char *mountpoint) { int fd; + if (mountpoint == NULL) { + fuse_log(FUSE_LOG_ERR, "Invalid null-ptr mountpoint!\n"); + return -1; + } + /* * Make sure file descriptors 0, 1 and 2 are open, otherwise chaos * would ensue. diff --git a/lib/mount_util.c b/lib/mount_util.c index dd32276..02a84ef 100644 --- a/lib/mount_util.c +++ b/lib/mount_util.c @@ -359,6 +359,11 @@ int fuse_mnt_parse_fuse_fd(const char *mountpoint) int fd = -1; int len = 0; + if (mountpoint == NULL) { + fprintf(stderr, "Invalid null-ptr mount-point!\n"); + return -1; + } + if (sscanf(mountpoint, "/dev/fd/%u%n", &fd, &len) == 1 && len == strlen(mountpoint)) { return fd; |