From 802d374a99cae37ec33a098e4df79cd9165e624e Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 7 Dec 2004 15:29:54 +0000 Subject: I'm a bad person. Stop treating the uint16_t's as null-terminated strings, and stop looking at the byte after them to see if it's null, because sometimes you're not allowed to look there. svn:r3108 --- src/or/circuituse.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/or/circuituse.c') diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 5ca699388a..775af1d960 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -255,19 +255,17 @@ void circuit_expire_building(time_t now) { void circuit_remove_handled_ports(smartlist_t *needed_ports) { int i; - uint16_t port; - char *portstring; + uint16_t *port; for (i = 0; i < smartlist_len(needed_ports); ++i) { - portstring = smartlist_get(needed_ports, i); - port = *(uint16_t*)(portstring); - tor_assert(port); - if (circuit_stream_is_being_handled(NULL, port, 2)) { + port = smartlist_get(needed_ports, i); + tor_assert(*port); + if (circuit_stream_is_being_handled(NULL, *port, 2)) { // log_fn(LOG_DEBUG,"Port %d is already being handled; removing.", port); smartlist_del(needed_ports, i--); - tor_free(portstring); + tor_free(port); } else { - log_fn(LOG_DEBUG,"Port %d is not handled.", port); + log_fn(LOG_DEBUG,"Port %d is not handled.", *port); } } } -- cgit v1.2.3-54-g00ecf