diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-05-15 21:17:48 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-05-15 21:17:48 +0000 |
commit | e043b86f47185e0d9df53dab12d42e46c8c35b83 (patch) | |
tree | 0ebfb1bbce0fbcfa7d6e470b98d5bf90e9889a02 /src/or | |
parent | bfdc366037690c74d1e6b73fc33e2f73842ed793 (diff) | |
download | tor-e043b86f47185e0d9df53dab12d42e46c8c35b83.tar.gz tor-e043b86f47185e0d9df53dab12d42e46c8c35b83.zip |
r12764@catbus: nickm | 2007-05-15 17:17:39 -0400
Enable (and cope with) more GCC 4.2 warnings.
svn:r10196
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/buffers.c | 14 | ||||
-rw-r--r-- | src/or/control.c | 16 | ||||
-rw-r--r-- | src/or/cpuworker.c | 2 | ||||
-rw-r--r-- | src/or/rendclient.c | 2 | ||||
-rw-r--r-- | src/or/test.c | 2 |
5 files changed, 21 insertions, 15 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 8e674eea0f..d043198337 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -1093,7 +1093,7 @@ int fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype, int safe_socks) { - unsigned char len; + unsigned int len; char tmpbuf[INET_NTOA_BUF_LEN]; uint32_t destip; enum {socks4, socks4a} socks4_prot = socks4a; @@ -1191,8 +1191,13 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, return 1; case 3: /* fqdn */ log_debug(LD_APP,"socks5: fqdn address type"); + if (req->command == SOCKS_COMMAND_RESOLVE_PTR) { + log_warn(LD_APP, "socks5 received RESOLVE_PTR command with " + "hostname type. Rejecting."); + return -1; + } len = (unsigned char)*(buf->cur+4); - if (buf->datalen < 7u+len) /* addr/port there? */ + if (buf->datalen < 7+len) /* addr/port there? */ return 0; /* not yet */ if (len+1 > MAX_SOCKS_ADDR_LEN) { log_warn(LD_APP, @@ -1200,11 +1205,6 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, "%d. Rejecting.", len+1,MAX_SOCKS_ADDR_LEN); return -1; } - if (req->command == SOCKS_COMMAND_RESOLVE_PTR) { - log_warn(LD_APP, "socks5 received RESOLVE_PTR command with " - "hostname type. Rejecting."); - return -1; - } memcpy(req->address,buf->cur+5,len); req->address[len] = 0; req->port = ntohs(get_uint16(buf->cur+5+len)); diff --git a/src/or/control.c b/src/or/control.c index 3e73510ce3..5100c16866 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -943,13 +943,18 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len, const char *errstr = NULL; char *password; size_t password_len; + const char *cp; + int i; if (TOR_ISXDIGIT(body[0])) { - int i = 0; - while (TOR_ISXDIGIT(body[i])) - ++i; - password = tor_malloc(i/2 + 1); - if (base16_decode(password, i/2+1, body, i)<0) { + cp = body; + while (TOR_ISXDIGIT(*cp)) + ++cp; + i = cp - body; + tor_assert(i>0); + password_len = i/2; + password = tor_malloc(password_len + 1); + if (base16_decode(password, password_len+1, body, i)<0) { connection_write_str_to_buf( "551 Invalid hexadecimal encoding. Maybe you tried a plain text " "password? If so, the standard requires that you put it in " @@ -957,7 +962,6 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len, tor_free(password); return 0; } - password_len = i/2; } else if (TOR_ISSPACE(body[0])) { password = tor_strdup(""); password_len = 0; diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 85583acea6..3bc6f9601b 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -36,7 +36,7 @@ static int num_cpuworkers_busy=0; * the last time we got a key rotation event. */ static time_t last_rotation_time=0; -static void cpuworker_main(void *data); +static void cpuworker_main(void *data) ATTR_NORETURN; static int spawn_cpuworker(void); static void spawn_enough_cpuworkers(void); static void process_pending_task(connection_t *cpuworker); diff --git a/src/or/rendclient.c b/src/or/rendclient.c index fad32f648f..f6d24595f4 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -141,8 +141,8 @@ rend_client_send_introduction(origin_circuit_t *introcirc, goto err; } - tor_assert(DIGEST_LEN + r <= RELAY_PAYLOAD_SIZE); /* we overran something */ payload_len = DIGEST_LEN + r; + tor_assert(payload_len <= RELAY_PAYLOAD_SIZE); /* we overran something */ if (relay_send_command_from_edge(0, TO_CIRCUIT(introcirc), RELAY_COMMAND_INTRODUCE1, diff --git a/src/or/test.c b/src/or/test.c index f5e9d51230..ba5f2a45a2 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -1207,6 +1207,8 @@ static tor_mutex_t *_thread_test_start1 = NULL; static tor_mutex_t *_thread_test_start2 = NULL; static strmap_t *_thread_test_strmap = NULL; +static void _thread_test_func(void* _s) ATTR_NORETURN; + static void _thread_test_func(void* _s) { |