Add nullptr check in fuse_session_mount
authorBernd Schubert <bschubert@ddn.com>
Tue, 25 Jun 2024 05:05:19 +0000 (07:05 +0200)
committerBernd Schubert <bernd.schubert@fastmail.fm>
Tue, 25 Jun 2024 09:34:16 +0000 (11:34 +0200)
The pointer did not have any sanity check.

Addresses https://github.com/libfuse/libfuse/issues/979

lib/fuse_lowlevel.c
lib/mount_util.c

index 74b04247812226a4e64078f2266b1d01a79dc450..8bfeb01279ebf3b5cbd42319c86d398335d22213 100644 (file)
@@ -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.
index dd3227686c5404b603f80291f4cd6fd30008bb24..02a84ef51a5b7c75c5552cd88952c5b6d7b0cdb8 100644 (file)
@@ -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;