SyncEngine: Fix a crash caused by an invalid DiscoveryDirectoryResult::iterator ...
authorJocelyn Turcotte <jturcotte@woboq.com>
Thu, 2 Apr 2015 13:16:33 +0000 (15:16 +0200)
committerJocelyn Turcotte <jturcotte@woboq.com>
Wed, 8 Apr 2015 07:35:43 +0000 (09:35 +0200)
commit4a890eae38f86d5f689983e84da951a1b42c17d8
treecac92df3861d7d091485837122eed0a7751079ff
parent760e11bc5d6fa6ace72bac4e536e95b023d41cea
SyncEngine: Fix a crash caused by an invalid DiscoveryDirectoryResult::iterator #3051

The default constructor of the iterator points to NULL, which makes
it != end() but invalid to dereference.

Use an integer index instead to keep 0 as a valid default value that
can always correctly be checked against size().

Also make sure that no data is shared between threads by making the
csync_vio_file_stat_t copyable and passing it as const.
src/libsync/discoveryphase.cpp
src/libsync/discoveryphase.h