1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-29 05:24:18 -04:00

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 <rgetz503@gmail.com>
This commit is contained in:
Robin Getz
2026-07-26 15:54:53 -04:00
parent b1e685b71c
commit 52f5055ef7
-7
View File
@@ -38,7 +38,6 @@ void SerialUtil::getComPorts(std::vector<std::string>& 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<std::string>& 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__)