From 7f7c2b977c400b71b4dd3b59f16f902b276bffba Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Mon, 20 Aug 2012 19:11:46 +0300 Subject: [PATCH] Avoid a null pointer dereference. --- src/csync_util.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/csync_util.c b/src/csync_util.c index 4f3af2a02..f4064d16b 100644 --- a/src/csync_util.c +++ b/src/csync_util.c @@ -229,9 +229,12 @@ static int _merge_file_trees_visitor(void *obj, void *data) { } tfs = c_rbtree_node_data(node); - fs->md5 = c_strdup( tfs->md5 ); - CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "PRE UPDATED %s: %s <-> %s", uri, fs->md5, tfs->md5); - + if( tfs->md5 ) { + fs->md5 = c_strdup( tfs->md5 ); + CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "PRE UPDATED %s: %s <-> %s", uri, fs->md5, tfs->md5); + } else { + CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "md5 is empty in merger!"); + } CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "file: %s, instruction: UPDATED (%s)", uri, fs->md5); fs->instruction = CSYNC_INSTRUCTION_NONE;