diff --git a/tool/client.cc b/tool/client.cc index 0301a816..8e0ef2d0 100644 --- a/tool/client.cc +++ b/tool/client.cc @@ -282,16 +282,16 @@ bool Client(const std::vector &args) { return false; } - if (args_map.count("-max-version") != 0) { - uint16_t version; - if (!VersionFromString(&version, args_map["-max-version"])) { - fprintf(stderr, "Unknown protocol version: '%s'\n", - args_map["-max-version"].c_str()); - return false; - } - if (!SSL_CTX_set_max_proto_version(ctx.get(), version)) { - return false; - } + uint16_t max_version = TLS1_3_VERSION; + if (args_map.count("-max-version") != 0 && + !VersionFromString(&max_version, args_map["-max-version"])) { + fprintf(stderr, "Unknown protocol version: '%s'\n", + args_map["-max-version"].c_str()); + return false; + } + + if (!SSL_CTX_set_max_proto_version(ctx.get(), max_version)) { + return false; } if (args_map.count("-min-version") != 0) { diff --git a/tool/server.cc b/tool/server.cc index 94abbbd9..f203df12 100644 --- a/tool/server.cc +++ b/tool/server.cc @@ -193,16 +193,16 @@ bool Server(const std::vector &args) { return false; } - if (args_map.count("-max-version") != 0) { - uint16_t version; - if (!VersionFromString(&version, args_map["-max-version"])) { - fprintf(stderr, "Unknown protocol version: '%s'\n", - args_map["-max-version"].c_str()); - return false; - } - if (!SSL_CTX_set_max_proto_version(ctx.get(), version)) { - return false; - } + uint16_t max_version = TLS1_3_VERSION; + if (args_map.count("-max-version") != 0 && + !VersionFromString(&max_version, args_map["-max-version"])) { + fprintf(stderr, "Unknown protocol version: '%s'\n", + args_map["-max-version"].c_str()); + return false; + } + + if (!SSL_CTX_set_max_proto_version(ctx.get(), max_version)) { + return false; } if (args_map.count("-min-version") != 0) {