s3:vfs:shadow_copy2: fix corner case of "/@GMT-token" in shadow_copy2_strip_snapshot
authorMichael Adam <obnox@samba.org>
Tue, 11 Apr 2017 10:03:52 +0000 (12:03 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 11 Apr 2017 23:41:13 +0000 (01:41 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_shadow_copy2.c

index 83be84e50a82976316d33b6ac8344daf7bd099ae..7cacac81c1c970b218ea917456b754e09703b197 100644 (file)
@@ -671,10 +671,11 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
                 * with a path prefix.
                 */
                if (pstripped != NULL) {
-                       if (len_before_gmt > 0) {
+                       if (len_before_gmt > 1) {
                                /*
-                                * There is a slash before
-                                * the @GMT-. Remove it.
+                                * There is a path (and not only a slash)
+                                * before the @GMT-. Remove the trailing
+                                * slash character.
                                 */
                                len_before_gmt -= 1;
                        }