1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:vfs:shadow_copy2: fix the corner case if cwd=/ in make_relative_path

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Michael Adam 2017-04-11 12:03:20 +02:00 committed by Jeremy Allison
parent fffd611fdc
commit 16c89835cf

View File

@ -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] == '/') {