From 5a8d90cc2523ba7fd2fee2e9557b08ec4efc87e1 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Tue, 19 Mar 2013 16:22:11 +0100 Subject: [PATCH] Fix path handling in update routine. --- src/csync_update.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/csync_update.c b/src/csync_update.c index a50d08af8c..d170611a6b 100644 --- a/src/csync_update.c +++ b/src/csync_update.c @@ -90,6 +90,27 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, return -1; } + path = file; + len = strlen(path); + switch (ctx->current) { + case LOCAL_REPLICA: + if (strlen(path) <= strlen(ctx->local.uri)) { + return -1; + } + path += strlen(ctx->local.uri) + 1; + break; + case REMOTE_REPLICA: + if (strlen(path) <= strlen(ctx->remote.uri)) { + return -1; + } + path += strlen(ctx->remote.uri) + 1; + break; + default: + path = NULL; + return -1; + break; + } + h = _hash_of_file(ctx, file ); // FIXME: What if h == 0?