s3:vfs:shadow_copy2: fix corner case of "/@GMT-token" in shadow_copy2_strip_snapshot
[sfrench/samba-autobuild/.git] / 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;
                        }