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

Loading…
Cancel
Save