From 92bf37e21d63c0c9edede1617c85510a16011e7a Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 17 Feb 2000 23:22:26 +0000 Subject: Don't assume that the (files_struct *) passed to fd_attempt_close() will be non-NULL. (This used to be commit 02f845e54351ec57ee873a8ed887285552c6ecab) --- source3/smbd/open.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 30409707d3..6352233dbc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -152,11 +152,18 @@ Decrements the ref_count and returns it. uint16 fd_attempt_close(files_struct *fsp, int *err_ret) { extern struct current_user current_user; - file_fd_struct *fd_ptr = fsp->fd_ptr; - uint16 ret_ref = fd_ptr->ref_count; + file_fd_struct *fd_ptr; + uint16 ret_ref; *err_ret = 0; + if ((fsp == NULL) || (fsp->fd_ptr == NULL)) { + return 0; + } + + fd_ptr = fsp->fd_ptr; + ret_ref = fd_ptr->ref_count; + DEBUG(3,("fd_attempt_close fd = %d, dev = %x, inode = %.0f, open_flags = %d, ref_count = %d.\n", fd_ptr->fd, (unsigned int)fd_ptr->dev, (double)fd_ptr->inode, fd_ptr->real_open_flags, -- cgit