]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: make sure smbXsrv_session_update() doesn't segfault with table == NULL
authorStefan Metzmacher <metze@samba.org>
Wed, 14 Jul 2021 15:15:52 +0000 (17:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 15 Jul 2021 00:06:31 +0000 (00:06 +0000)
There might be other places than smb2srv_update_crypto_flags(), which
may call smbXsrv_session_update() with a fake session, they should
return in error instead of segfaulting.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smbXsrv_session.c

index 70a45a955336722b5579f89498ad3915285f9b17..01512f3113f9b62dc6f1ed7b99284960343d595f 100644 (file)
@@ -1426,6 +1426,13 @@ NTSTATUS smbXsrv_session_update(struct smbXsrv_session *session)
                return NT_STATUS_INTERNAL_ERROR;
        }
 
+       if (table == NULL) {
+               DEBUG(0, ("smbXsrv_session_update(0x%08x): "
+                         "Called with table == NULL'\n",
+                         session->global->session_global_id));
+               return NT_STATUS_INTERNAL_ERROR;
+       }
+
        session->global->db_rec = smbXsrv_session_global_fetch_locked(
                                        table->global.db_ctx,
                                        session->global->session_global_id,