smbd: Fix CID 240676 Dereference after null check
[metze/samba/wip.git] / source3 / smbd / open.c
index 643e074f399a688c508d2e91e52e3aee0ec8da9e..3c24d76a089382cbd26fbb1fb6709cf93eda312b 100644 (file)
@@ -5079,6 +5079,13 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
        if (lease != NULL) {
                uint16_t epoch = lease->lease_epoch;
                uint16_t version = lease->lease_version;
+
+               if (req == NULL) {
+                       DBG_WARNING("Got lease on internal open\n");
+                       status = NT_STATUS_INTERNAL_ERROR;
+                       goto fail;
+               }
+
                status = lease_match(conn,
                                req,
                                &lease->lease_key,