703rc/fix port size (#802)

* validate port numbers in client

* validate port numbers created at virtual servers and receiver process as tcp ports
This commit is contained in:
2023-09-18 08:59:53 +02:00
committed by GitHub
parent b367b7e431
commit 48759f440e
12 changed files with 148 additions and 11 deletions

View File

@ -203,4 +203,13 @@ MacAddr InterfaceNameToMac(const std::string &inf) {
return MacAddr(mac);
}
void validatePortNumber(int port) {
if (0 >= port || port > std::numeric_limits<uint16_t>::max()) {
std::ostringstream oss;
oss << "Invalid port number " << port << ". It must be in range 1 - "
<< std::numeric_limits<uint16_t>::max();
throw RuntimeError(oss.str());
}
}
} // namespace sls