This commits covers a single class of string-copy
issues, all of which involve writing an unchecked
quantity of bytes into a string of a fixed length (ie:
char[]).
Bitu (aka uintptr_t) is not necessary for handling shortened files,
as we can represent max 10^7 shortened files anyway; unsigned is good
enough.
This allows use to use simple %u for conversion instead of PRIuPTR,
which caused a bug on AmigaOS on PPC.
Fixes: #162
Class DOS_Drive_Cache is declared in dos_system.h, but this header was
indirectly included. Remove faulty windows.h include (the correct one
exists in cross.h already).
This way we prevent pointless dynamic_cast; correct usage of
dynamic_cast requires a nullcheck, which was missing in this case
causing Coverity to complain.
Instead of changing cast, let's make this method a virtual one in base
class - this way we could reuse it in future for cases outside of CD-ROM
(e.g. write-protected floppies).
- Move imageDiskList from pointer to vector of unique_ptr
- Replace string operations with size-limited versions
- Initialize members
- Eliminate unecessary casts
- Eliminate memory-leak on pointer assignment
- Limit write length into buffer, and add comment about corner-case
- Use C++11's syntax to explicitly remove private copy and assignment operators
- Use C++11 container loop syntax to shorting a cleanup function
- Fix Bitu printf format type
- Check a pointer prior to dereferencing it
- Prevent writing one-beyond the last index
- Replace strcpy with with helper safe_strcpy, provided by @dreamer - thank you!
- Replace strcat with strncat
- Add constructor intializers for scalars and arrays
- Initialize and replace 0-value pointers with nullptr
- Pass in the buffer length when strncpy'ing into a function variable
When active, this drive redirects new and changed files to a different location.
The files in the overlay and normal drive are merged on startup and kept up to date when the game changes something.
Files in the overlay are priotizedi, if they exists, above the normal files.
The drive will switch to an overlayed version of the file on the first write! (Not when opening the file in write-mode).
The overlay is capable of creating missing directories.
With the help of DBOVERLAY files, the drive keeps track of files that are present in the normal directory but deleted by the game.
All changes are preserved between sessions.
Current design principles/limitations/requirements:
1) All directories that can be used for saving, must exist already in the base before mounting. (they will be created by DOSBox if missing in the overlay)
2) All filenames inside the overlay directories are UPPERCASE and conform to the 8.3 standard except for the special DBOVERLAY files.
3) To keep point 1 valid at all times, support for creating/renaming/removing directories has been disabled.
Thanks for the help GOG.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4196
Added support for volume label searching on Virtual Drives.
Added warnings for volume searching on Drive Fat.
Improved support for Filelabel searching on drive_local to include fcbfinds
Added Drivelabel "DOSBOX" to Virtual Drives.
Changed default Label for localdrives to "NO_LABEL".
Made DOS_FindFirst fcb finds aware.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1770