From 7bb3ef95ecb83c82895df1ce582948da3fb04dd3 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Wed, 6 May 2026 20:30:53 -0400 Subject: [PATCH] Add empty key validation in parseRelayConf() --- src/wg/relayconf.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wg/relayconf.cpp b/src/wg/relayconf.cpp index 362a82a..72a10dd 100644 --- a/src/wg/relayconf.cpp +++ b/src/wg/relayconf.cpp @@ -42,6 +42,11 @@ bool parseRelayConf(const std::string &path, RelayConf &conf, std::string &errOu std::string key = trim(trimmed.substr(0, eq)); std::string value = trim(trimmed.substr(eq + 1)); + if (key.empty()) { + errOut = "relay.conf line " + std::to_string(lineNum) + ": missing key before '='"; + return false; + } + if (key == "server_address") conf.server_address = value; else if (key == "private_key") conf.private_key = value; else if (key == "server_public_key") conf.server_public_key = value;