projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eab9337
)
sock_connect() returns with an error if the supplied host,
author
Art Cancro
<ajc@citadel.org>
Mon, 26 Feb 2007 21:39:25 +0000
(21:39 +0000)
committer
Art 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
patch
|
blob
|
history
diff --git
a/citadel/clientsocket.c
b/citadel/clientsocket.c
index c90134f74175991a657d79f308cd3bec6077b179..c2f992ed72013163a08f61b246738766bb85b3bf 100644
(file)
--- 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;