Protect against early error in SMB_VFS_NEXT_READDIR.
authorJeremy Allison <jra@samba.org>
Mon, 8 Apr 2013 23:31:53 +0000 (16:31 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 17 Apr 2013 06:57:04 +0000 (08:57 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/modules/vfs_dirsort.c

index 813955684aee16732b09cea95d25a9bbb905fa6e..6fe7c184146185a109d20eb23de7805b34cb0aa0 100644 (file)
@@ -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);