From 8f0e945f0cc7019e376b15b0eff675fd84585c1d Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Sat, 6 Sep 2025 21:58:20 -0400 Subject: [PATCH] livoxGen1: Validate smo-ip provider-param --- senseApis/livoxGen1/livoxGen1.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/senseApis/livoxGen1/livoxGen1.cpp b/senseApis/livoxGen1/livoxGen1.cpp index 6ce2447..2ed6ddd 100644 --- a/senseApis/livoxGen1/livoxGen1.cpp +++ b/senseApis/livoxGen1/livoxGen1.cpp @@ -192,7 +192,18 @@ extern "C" int livoxGen1_attachDeviceReq( imuPort = static_cast( 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