windows-explorer-remove-mountpt-fix-20050719
authorJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 19 Jul 2005 06:06:12 +0000 (06:06 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 19 Jul 2005 06:06:12 +0000 (06:06 +0000)
FIXES 20137

the gui version of fs rmmount was reading random memory.

src/WINNT/client_exp/gui2fs.cpp

index 64a2d1c..efc7061 100644 (file)
@@ -1236,6 +1236,7 @@ BOOL IsMountPoint(const char * name)
     char lsbuffer[1024];
     register char *tp;
     char szCurItem[1024];
+
     strcpy(szCurItem, name);
        
     tp = (char *)strrchr(szCurItem, '\\');
@@ -1274,6 +1275,7 @@ BOOL RemoveMount(CStringArray& files)
     char tbuffer[1024];
     char lsbuffer[1024];
     register char *tp;
+    char szCurItem[1024];
     BOOL error = FALSE;
     CStringArray results;
     CString str;
@@ -1291,6 +1293,20 @@ BOOL RemoveMount(CStringArray& files)
             continue;  // don't bother trying
         }
 
+        strcpy(szCurItem, files[i]);
+       
+        tp = (char *)strrchr(szCurItem, '\\');
+        if (tp) {
+            strncpy(tbuffer, szCurItem, code = tp - szCurItem + 1);  /* the dir name */
+            tbuffer[code] = 0;
+            tp++;   /* skip the slash */
+        } else {
+            fs_ExtractDriveLetter(szCurItem, tbuffer);
+            strcat(tbuffer, ".");
+            tp = szCurItem;
+            fs_StripDriveLetter(tp, tp, 0);
+        }
+
         blob.out_size = 0;
         blob.in = tp;
         blob.in_size = strlen(tp)+1;