summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_dirsort.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-04-08 16:31:53 -0700
committerJeremy Allison <jra@samba.org>2013-04-11 09:49:41 -0700
commitb30697f6388600d1557a96ff3ff3a3548ee99d69 (patch)
tree238922756d8e5189fe977287ad0f2c3389e7f25f /source3/modules/vfs_dirsort.c
parentc55eb371144d0ab91b1254b85f2b2a3d4aab8b68 (diff)
downloadsamba-b30697f6388600d1557a96ff3ff3a3548ee99d69.tar.gz
samba-b30697f6388600d1557a96ff3ff3a3548ee99d69.tar.bz2
samba-b30697f6388600d1557a96ff3ff3a3548ee99d69.zip
Protect against early error in SMB_VFS_NEXT_READDIR.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/modules/vfs_dirsort.c')
-rw-r--r--source3/modules/vfs_dirsort.c4
1 files changed, 4 insertions, 0 deletions
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);