vfat: Fix mangling of directory names starting with ..
authorRich Mahn <rich@lat.com>
Mon, 4 Apr 2011 22:46:06 +0000 (15:46 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Mon, 4 Apr 2011 22:46:06 +0000 (15:46 -0700)
We need to handle directory names starting with .. correctly.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
core/fs/fat/fat.c

index c896b5e..d307926 100644 (file)
@@ -254,8 +254,10 @@ static void vfat_mangle_name(char *dst, const char *src)
     while (1) {
         if (dst == p)
             break;
-               if (*(dst-1) == '/' && dst-1 == p) /* it's the '/' case */
-                       break;
+       if (*(dst-1) == '/' && dst-1 == p) /* it's the '/' case */
+               break;
+       if (dst-2 == p && *(dst-2) == '.' && *(dst-1) == '.' )  /* the '..' case */
+               break;
         if ((*(dst-1) != '/') && (*(dst-1) != '.'))
             break;