diff --git a/subsystems/ntvdm/dos.c b/subsystems/ntvdm/dos.c index 4f5d4866652..30ecf8c1290 100644 --- a/subsystems/ntvdm/dos.c +++ b/subsystems/ntvdm/dos.c @@ -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;