livoxGen1: Validate smo-ip provider-param

This commit is contained in:
2025-09-06 21:58:20 -04:00
parent 5d55157ffd
commit 8f0e945f0c
+12 -1
View File
@@ -192,7 +192,18 @@ extern "C" int livoxGen1_attachDeviceReq(
imuPort = static_cast<uint16_t>(
smo::device::DeviceAttachmentSpec
::parseRequiredParamAsInt(*desc, "imu-port"));
} else if (param.first == "smo-ip") {
} else if (param.first == "smo-ip")
{
if (param.second.empty())
{
throw std::runtime_error(
std::string(__func__) + ": smo-ip parameter is empty");
}
if (param.second.find('.') == std::string::npos)
{
throw std::runtime_error(
std::string(__func__) + ": smo-ip parameter is not an IPv4 address");
}
smoIp = param.second;
}
else