diff options
author | Jeremy Allison <jra@samba.org> | 2016-12-19 12:32:07 -0800 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2017-03-22 10:48:06 +0100 |
commit | 2594b8bdccb4aecc69c1e01399b006c1abc6d7ad (patch) | |
tree | b597e1805f20f8b9ef2c6643e9b838fadcbe24f9 | |
parent | 7e915c87a76e4eedcd2abcf84bbdb806e3232976 (diff) | |
download | samba-2594b8bdccb4aecc69c1e01399b006c1abc6d7ad.tar.gz |
CVE-2017-2619: s3: smbd: Move the reference counting and destructor setup to just before retuning success.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12496
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
-rw-r--r-- | source3/smbd/dir.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 42e787bed6c..2fd50850665 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1783,11 +1783,6 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn, goto fail; } - if (sconn && !sconn->using_smb2) { - sconn->searches.dirhandles_open++; - } - talloc_set_destructor(dirp, smb_Dir_destructor); - dirp->dir = SMB_VFS_FDOPENDIR(fsp, mask, attr); if (dirp->dir != NULL) { dirp->fsp = fsp; @@ -1816,6 +1811,11 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn, goto fail; } + if (sconn && !sconn->using_smb2) { + sconn->searches.dirhandles_open++; + } + talloc_set_destructor(dirp, smb_Dir_destructor); + return dirp; fail: |