From c4839767316a9e74a26e0691873e4e84357905a2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 8 Apr 2013 16:31:53 -0700 Subject: [PATCH] Protect against early error in SMB_VFS_NEXT_READDIR. Signed-off-by: Jeremy Allison Reviewed-by: Andreas Schneider --- source3/modules/vfs_dirsort.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c index 813955684ae..6fe7c184146 100644 --- a/source3/modules/vfs_dirsort.c +++ b/source3/modules/vfs_dirsort.c @@ -61,6 +61,10 @@ static bool open_and_sort_dir (vfs_handle_struct *handle) data->number_of_entries++; } + if (data->number_of_entries == 0) { + return false; + } + /* Open the underlying directory and count the number of entries Skip back to the beginning as we'll read it again */ SMB_VFS_NEXT_REWINDDIR(handle, data->source_directory); -- 2.11.4.GIT