diff --git a/dlib/sockets/sockets_extensions.cpp b/dlib/sockets/sockets_extensions.cpp index 257a31e9b..a33a8885f 100644 --- a/dlib/sockets/sockets_extensions.cpp +++ b/dlib/sockets/sockets_extensions.cpp @@ -26,7 +26,7 @@ namespace dlib { std::istringstream sin(full_address); sin >> *this; - if (!sin) + if (!sin || sin.peek() != EOF) throw invalid_network_address("invalid network address: " + full_address); }