Improve memory safety in the DOS Drive Cache class
- 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
This commit is contained in:
parent
88cdd8d3a0
commit
cff6b05559
4 changed files with 200 additions and 115 deletions
|
@ -185,6 +185,8 @@ public:
|
|||
imageDisk *loadedDisk;
|
||||
bool created_successfully;
|
||||
private:
|
||||
fatDrive(const fatDrive&); // prevent copying
|
||||
fatDrive& operator= (const fatDrive&); // prevent assignment
|
||||
Bit32u getClusterValue(Bit32u clustNum);
|
||||
void setClusterValue(Bit32u clustNum, Bit32u clustValue);
|
||||
Bit32u getClustFirstSect(Bit32u clustNum);
|
||||
|
@ -408,6 +410,8 @@ public:
|
|||
virtual Bits UnMount(void);
|
||||
virtual char const* GetLabel(void);
|
||||
private:
|
||||
Virtual_Drive(const Virtual_Drive&); // prevent copying
|
||||
Virtual_Drive& operator= (const Virtual_Drive&); // prevent assignment
|
||||
VFILE_Block * search_file;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue