[NTVDM]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Sun, 11 Aug 2013 21:07:09 +0000 (21:07 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Sun, 11 Aug 2013 21:07:09 +0000 (21:07 +0000)
Fix bug in DosChangeDirectory.

svn path=/branches/ntvdm/; revision=59701

subsystems/ntvdm/dos.c

index 4f5d486..30ecf8c 100644 (file)
@@ -892,10 +892,16 @@ BOOLEAN DosChangeDirectory(LPSTR Directory)
     }
 
     /* Get the directory part of the path */
-    Path = strchr(Directory, '\\') + 1;
+    Path = strchr(Directory, '\\');
+    if (Path != NULL)
+    {
+        /* Skip the backslash */
+        Path++;
+    }
 
     /* Set the directory for the drive */
-    strcpy(CurrentDirectories[DriveNumber], Path);
+    if (Path != NULL) strcpy(CurrentDirectories[DriveNumber], Path);
+    else strcpy(CurrentDirectories[DriveNumber], "");
     
     /* Return success */
     return TRUE;