From: Art Cancro Date: Mon, 26 Feb 2007 21:39:25 +0000 (+0000) Subject: sock_connect() returns with an error if the supplied host, X-Git-Tag: v7.86~3556 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=7c94d88ac779760e481d744fc917715db6b6544c;p=citadel.git sock_connect() returns with an error if the supplied host, port, or protocol is null or zero length --- diff --git a/citadel/clientsocket.c b/citadel/clientsocket.c index c90134f74..c2f992ed7 100644 --- a/citadel/clientsocket.c +++ b/citadel/clientsocket.c @@ -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;