From 4ba7bfde71bd6e4e3b02147a2b7989bea283070b Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Tue, 10 Dec 2024 21:23:05 -0330 Subject: [PATCH] Fix potential uninitialized array access. --- src/os/windows/FSNodeWINDOWS.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/os/windows/FSNodeWINDOWS.cxx b/src/os/windows/FSNodeWINDOWS.cxx index 99498fe4b..7549a528d 100644 --- a/src/os/windows/FSNodeWINDOWS.cxx +++ b/src/os/windows/FSNodeWINDOWS.cxx @@ -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 drive_buffer; + GetLogicalDriveStrings(static_cast(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;