From c32cd0387299a1a0e5b99a9322daba1cf88d7b8d Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 17 Sep 2022 00:06:02 +0100 Subject: [PATCH] Validation for GDB port config param --- src/DebugServer/Gdb/GdbDebugServerConfig.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/DebugServer/Gdb/GdbDebugServerConfig.cpp b/src/DebugServer/Gdb/GdbDebugServerConfig.cpp index bd07ca56..3c8ab47c 100644 --- a/src/DebugServer/Gdb/GdbDebugServerConfig.cpp +++ b/src/DebugServer/Gdb/GdbDebugServerConfig.cpp @@ -20,9 +20,15 @@ namespace Bloom::DebugServer::Gdb } if (debugServerConfig.debugServerNode["port"]) { - this->listeningPortNumber = static_cast( - debugServerConfig.debugServerNode["port"].as() - ); + if (YamlUtilities::isType(debugServerConfig.debugServerNode["port"])) { + this->listeningPortNumber = debugServerConfig.debugServerNode["port"].as(); + + } else { + Logger::error( + "Invalid GDB debug server config parameter ('port') provided - value must be castable to a 16-bit " + "unsigned integer. The parameter will be ignored." + ); + } } } }