dd3c47
diff --git a/src/tar.c b/src/tar.c
dd3c47
index 97d74bc..6de8961 100644
dd3c47
--- a/src/tar.c
dd3c47
+++ b/src/tar.c
dd3c47
@@ -48,10 +48,12 @@ split_long_name (const char *name, size_t length)
dd3c47
 {
dd3c47
   size_t i;
dd3c47
 
dd3c47
-  if (length > TARPREFIXSIZE)
dd3c47
-    length = TARPREFIXSIZE+2;
dd3c47
+  if (length > TARPREFIXSIZE + 1)
dd3c47
+    length = TARPREFIXSIZE + 1;
dd3c47
+  else if (ISSLASH (name[length - 1]))
dd3c47
+    length--;
dd3c47
   for (i = length - 1; i > 0; i--)
dd3c47
-    if (name[i] == '/')
dd3c47
+    if (ISSLASH (name[i]))
dd3c47
       break;
dd3c47
   return i;
dd3c47
 }