diff options
author | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-04-07 17:55:04 +0300 |
---|---|---|
committer | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-04-08 10:35:43 +0300 |
commit | d475628c70c5947fefdb2afe84ffba93b4fa6a8d (patch) | |
tree | 28f0c4e231ce8067ec713beb188c77c48d88634a /csync | |
parent | 4a890eae38f86d5f689983e84da951a1b42c17d8 (diff) |
SyncEngine: Fix a crash in csync_vio_file_stat_copy #3051
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.
Diffstat (limited to 'csync')
-rw-r--r-- | csync/src/vio/csync_vio_file_stat.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/csync/src/vio/csync_vio_file_stat.c b/csync/src/vio/csync_vio_file_stat.c index a7fd2f0b3..ffbd102fc 100644 --- a/csync/src/vio/csync_vio_file_stat.c +++ b/csync/src/vio/csync_vio_file_stat.c @@ -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); } |