sock_connect() returns with an error if the supplied host,
authorArt Cancro <ajc@citadel.org>
Mon, 26 Feb 2007 21:39:25 +0000 (21:39 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 26 Feb 2007 21:39:25 +0000 (21:39 +0000)
port, or protocol is null or zero length

citadel/clientsocket.c

index c90134f74175991a657d79f308cd3bec6077b179..c2f992ed72013163a08f61b246738766bb85b3bf 100644 (file)
@@ -44,6 +44,13 @@ int sock_connect(char *host, char *service, char *protocol)
        struct sockaddr_in sin;
        int s, type;
 
+       if (host == NULL) return(-1);
+       if (strlen(host) == 0) return(-1);
+       if (service == NULL) return(-1);
+       if (strlen(service) == 0) return(-1);
+       if (protocol == NULL) return(-1);
+       if (strlen(protocol) == 0) return(-1);
+
        memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;