From 52f5055ef75cac2fcd81776b7db4eb25f73051db Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 26 Jul 2026 15:54:53 -0400 Subject: [PATCH] serialutil: Remove dead code in Windows COM port enumeration Remove an invalid out-of-bounds array access that attempted to handle ERROR_INSUFFICIENT_BUFFER. The statement did not resize the fixed-size buffer and had no effect other than invoking undefined behavior. The function only uses QueryDosDeviceA() as an existence check for COM ports, so removing the dead error-handling code does not change its behavior. Signed-off-by: Robin Getz --- sdrbase/util/serialutil.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sdrbase/util/serialutil.cpp b/sdrbase/util/serialutil.cpp index 183718efd..4eb4d2c50 100644 --- a/sdrbase/util/serialutil.cpp +++ b/sdrbase/util/serialutil.cpp @@ -38,7 +38,6 @@ void SerialUtil::getComPorts(std::vector& comPorts, const std::stri (void) regexStr; TCHAR lpTargetPath[5000]; // buffer to store the path of the COMPORTS DWORD test; - bool gotPort = 0; // in case the port is not found char portName[100]; @@ -53,12 +52,6 @@ void SerialUtil::getComPorts(std::vector& comPorts, const std::stri { comPorts.push_back(std::string(portName)); } - - if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) - { - lpTargetPath[10000]; // in case the buffer got filled, increase size of the buffer. - continue; - } } } #elif defined(__linux__)