From 16c89835cf07caa2082b586666095deba38ef962 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 11 Apr 2017 12:03:20 +0200 Subject: [PATCH] s3:vfs:shadow_copy2: fix the corner case if cwd=/ in make_relative_path Signed-off-by: Michael Adam Reviewed-by: Jeremy Allison --- source3/modules/vfs_shadow_copy2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index f3ec8b61ab5..83be84e50a8 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -444,7 +444,11 @@ static bool make_relative_path(const char *cwd, char *abs_path) if (memcmp(abs_path, cwd, cwd_len) != 0) { return false; } - if (abs_path[cwd_len] != '/' && abs_path[cwd_len] != '\0') { + /* The cwd_len != 1 case is for $cwd == '/' */ + if (cwd_len != 1 && + abs_path[cwd_len] != '/' && + abs_path[cwd_len] != '\0') + { return false; } if (abs_path[cwd_len] == '/') { -- 2.11.4.GIT