Add empty key validation in parseRelayConf()
This commit is contained in:
parent
4318387637
commit
7bb3ef95ec
1 changed files with 5 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue