OSDN Git Service

Port range check was implemented. port-limit-check
authorShinya TAKEBAYASHI <makoto@kanon-net.jp>
Fri, 25 Dec 2009 00:43:23 +0000 (09:43 +0900)
committerShinya TAKEBAYASHI <makoto@kanon-net.jp>
Fri, 25 Dec 2009 00:43:23 +0000 (09:43 +0900)
l7vsadm command can specify the port number greater than 65536.
This problem was fixed.

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;