[Pkg-owncloud-commits] [owncloud-client] 80/159: SyncEngine: Fix a crash in csync_vio_file_stat_copy #3051

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri May 1 13:05:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit d475628c70c5947fefdb2afe84ffba93b4fa6a8d
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Tue Apr 7 16:55:04 2015 +0200

    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.
---
 csync/src/vio/csync_vio_file_stat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/csync/src/vio/csync_vio_file_stat.c b/csync/src/vio/csync_vio_file_stat.c
index a7fd2f0..ffbd102 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);
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list