Skip to content

Commit

Permalink
Fix potential uninitialized array access.
Browse files Browse the repository at this point in the history
  • Loading branch information
sa666666 committed Dec 11, 2024
1 parent 9141731 commit 4ba7bfd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/os/windows/FSNodeWINDOWS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ bool FSNodeWINDOWS::getChildren(AbstractFSList& myList, ListMode mode) const
else
{
// Drives enumeration
TCHAR drive_buffer[100];
GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer);
static std::array<TCHAR, 100> drive_buffer;
GetLogicalDriveStrings(static_cast<DWORD>(drive_buffer.size()), drive_buffer.data());

char drive_name[2] = { '\0', '\0' };
for (TCHAR *current_drive = drive_buffer; *current_drive;
static char drive_name[2] = { '\0', '\0' };
for (TCHAR* current_drive = drive_buffer.data(); *current_drive;
current_drive += _tcslen(current_drive) + 1)
{
FSNodeWINDOWS entry;
Expand Down

0 comments on commit 4ba7bfd

Please sign in to comment.