summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redfish-core/lib/certificate_service.hpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 9b4f60ec62..f82363bc3a 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -17,6 +17,8 @@
#include "node.hpp"
+#include <boost/convert.hpp>
+#include <boost/convert/strtol.hpp>
#include <variant>
namespace redfish
{
@@ -104,17 +106,14 @@ long getIDFromURL(const std::string_view url)
{
return -1;
}
+
if ((found + 1) < url.length())
{
- char *endPtr;
std::string_view str = url.substr(found + 1);
- long value = std::strtol(str.data(), &endPtr, 10);
- if (endPtr != str.end())
- {
- return -1;
- }
- return value;
+
+ return boost::convert<long>(str, boost::cnv::strtol()).value_or(-1);
}
+
return -1;
}