From b30697f6388600d1557a96ff3ff3a3548ee99d69 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 8 Apr 2013 16:31:53 -0700 Subject: 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(+) (limited to 'source3/modules') diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c index 813955684a..6fe7c18414 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); -- cgit