smbXsrv_client: make sure that we store a valid blob
[gd/samba-autobuild/.git] / source3 / smbd / smbXsrv_client.c
index f81fff40bb7794c2adeffeaabce45060738fa109..ec5b5f1d04c24d60a034e868802b3f8acff488df 100644 (file)
@@ -294,6 +294,13 @@ NTSTATUS smb2srv_client_lookup_global(struct smbXsrv_client *client,
                return NT_STATUS_OBJECTID_NOT_FOUND;
        }
 
+       if (global == NULL) {
+               /*
+                * most likely ndr_pull_struct_blob() failed
+                */
+               return NT_STATUS_INTERNAL_DB_CORRUPTION;
+       }
+
        *_global = global;
        return NT_STATUS_OK;
 }
@@ -375,6 +382,10 @@ static NTSTATUS smbXsrv_client_global_store(struct smbXsrv_client_global0 *globa
         * store the information in the old format.
         */
 
+       SMB_ASSERT(global->local_address != NULL);
+       SMB_ASSERT(global->remote_address != NULL);
+       SMB_ASSERT(global->remote_name != NULL);
+
        if (global->db_rec == NULL) {
                return NT_STATUS_INTERNAL_ERROR;
        }