OSDN Git Service

Port range check was implemented.
[ultramonkey-l7/ultramonkey-l7-v2.git] / src / l7vsadm_main.c
index 6cbeea6..4c7a3ee 100644 (file)
@@ -2319,6 +2319,14 @@ parse_endpoint(struct sockaddr_in *addr, const char *endpoint_str, int allow_ina
        }
        *t++ = '\0';
 
+       if (atoi(t) > 65535) {
+               LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_PARSE,8,
+                               "Port number is invalid.");
+               fprintf(stderr, "PARSE ERROR : "
+                               "Cannot specify port number greater than 65536.\n");
+       }
+
+
        memset(&hints, 0, sizeof(hints));
        hints.ai_family = PF_INET; /* inet only. no support for inet6 (yet) */
        hints.ai_socktype = SOCK_STREAM;