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, 19 Jun 2013 08:55:34 +0000 (10:55 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/modules/vfs_dirsort.c

index 88191b04f7afc2dec6e05f02010d3b79227aeb9b..7185e5b0a6ce0ef1cd3737b8f918a4d69cf49536 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);