summaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-15 21:17:48 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-15 21:17:48 +0000
commite043b86f47185e0d9df53dab12d42e46c8c35b83 (patch)
tree0ebfb1bbce0fbcfa7d6e470b98d5bf90e9889a02 /src/or/buffers.c
parentbfdc366037690c74d1e6b73fc33e2f73842ed793 (diff)
downloadtor-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/buffers.c')
-rw-r--r--src/or/buffers.c14
1 files changed, 7 insertions, 7 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));