Skip to content

Commit

Permalink
SyncEngine: Fix a crash in csync_vio_file_stat_copy #3051
Browse files Browse the repository at this point in the history
In some cryptic cases where the getetag property wasn't returned by
the server, we might be trying to c_strdup a null pointer in
csync_vio_file_stat_copy.

At least avoid crashing in this case by looking for
CSYNC_VIO_FILE_STAT_FIELDS_ETAG, like csync_vio_file_stat_destroy
does.
  • Loading branch information
jturcotte committed Apr 8, 2015
1 parent 4a890ea commit d475628
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion csync/src/vio/csync_vio_file_stat.c
Expand Up @@ -30,7 +30,9 @@ csync_vio_file_stat_t *csync_vio_file_stat_new(void) {
csync_vio_file_stat_t* csync_vio_file_stat_copy(csync_vio_file_stat_t *file_stat) {
csync_vio_file_stat_t *file_stat_cpy = csync_vio_file_stat_new();
memcpy(file_stat_cpy, file_stat, sizeof(csync_vio_file_stat_t));
file_stat_cpy->etag = c_strdup(file_stat_cpy->etag);
if (file_stat_cpy->fields & CSYNC_VIO_FILE_STAT_FIELDS_ETAG) {
file_stat_cpy->etag = c_strdup(file_stat_cpy->etag);
}
if (file_stat_cpy->directDownloadCookies) {
file_stat_cpy->directDownloadCookies = c_strdup(file_stat_cpy->directDownloadCookies);
}
Expand Down

0 comments on commit d475628

Please sign in to comment.