Browse Source

Add sanity check and extra debug message

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
3acd51597a
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      src/net/tcp.c

+ 5
- 0
src/net/tcp.c View File

@@ -277,6 +277,7 @@ static void tcp_close ( struct tcp_connection *tcp, int rc ) {
277 277
 		stop_timer ( &tcp->timer );
278 278
 		list_del ( &tcp->list );
279 279
 		ref_put ( &tcp->refcnt );
280
+		DBGC ( tcp, "TCP %p connection deleted\n", tcp );
280 281
 		return;
281 282
 	}
282 283
 
@@ -980,6 +981,10 @@ struct socket_opener tcp_socket_opener __socket_opener = {
980 981
 static int tcp_open_uri ( struct xfer_interface *xfer, struct uri *uri ) {
981 982
 	struct sockaddr_tcpip peer;
982 983
 
984
+	/* Sanity check */
985
+	if ( ! uri->host )
986
+		return -EINVAL;
987
+
983 988
 	memset ( &peer, 0, sizeof ( peer ) );
984 989
 	peer.st_port = htons ( uri_port ( uri, 0 ) );
985 990
 	return xfer_open_named_socket ( xfer, SOCK_STREAM,

Loading…
Cancel
Save