Fix potential uninitialized array access.

This commit is contained in:
Stephen Anthony 2024-12-10 21:23:05 -03:30
parent 91417312f1
commit 4ba7bfde71
1 changed files with 4 additions and 4 deletions

View File

@ -152,11 +152,11 @@ bool FSNodeWINDOWS::getChildren(AbstractFSList& myList, ListMode mode) const
else else
{ {
// Drives enumeration // Drives enumeration
TCHAR drive_buffer[100]; static std::array<TCHAR, 100> drive_buffer;
GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer); GetLogicalDriveStrings(static_cast<DWORD>(drive_buffer.size()), drive_buffer.data());
char drive_name[2] = { '\0', '\0' }; static char drive_name[2] = { '\0', '\0' };
for (TCHAR *current_drive = drive_buffer; *current_drive; for (TCHAR* current_drive = drive_buffer.data(); *current_drive;
current_drive += _tcslen(current_drive) + 1) current_drive += _tcslen(current_drive) + 1)
{ {
FSNodeWINDOWS entry; FSNodeWINDOWS entry;