[tor-commits] [torsocks/master] Fix: use unsigned char for socks5 ABI

dgoulet at torproject.org dgoulet at torproject.org
Fri Apr 4 22:40:27 UTC 2014


commit 906f5fefa855abbb48d1ea2496450ceb0f9d688e
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Thu Feb 20 13:02:14 2014 +0000

    Fix: use unsigned char for socks5 ABI
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/common/socks5.c |    8 ++++----
 src/common/socks5.h |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/common/socks5.c b/src/common/socks5.c
index fb0dc9c..9525d04 100644
--- a/src/common/socks5.c
+++ b/src/common/socks5.c
@@ -250,7 +250,7 @@ int socks5_send_connect_request(struct connection *conn)
 {
 	int ret;
 	/* Buffer to send won't go over a full TCP size. */
-	char buffer[1500];
+	unsigned char buffer[1500];
 	ssize_t buf_len, ret_send;
 	struct socks5_request msg;
 
@@ -355,7 +355,7 @@ int socks5_recv_connect_reply(struct connection *conn)
 {
 	int ret;
 	ssize_t ret_recv;
-	char buffer[22];	/* Maximum size possible (with IPv6). */
+	unsigned char buffer[22];	/* Maximum size possible (with IPv6). */
 	struct socks5_reply msg;
 	size_t recv_len;
 
@@ -453,7 +453,7 @@ int socks5_send_resolve_request(const char *hostname, struct connection *conn)
 	 * Can't go bigger than that. 4 bytes for the header, 1 for the name len
 	 * and 255 for the name.
 	 */
-	char buffer[260];
+	unsigned char buffer[260];
 	size_t name_len, msg_len, data_len;
 	struct socks5_request msg;
 	struct socks5_request_resolve req;
@@ -588,7 +588,7 @@ ATTR_HIDDEN
 int socks5_send_resolve_ptr_request(struct connection *conn, const void *ip, int af)
 {
 	int ret, ret_send;
-	char buffer[20];	/* Can't go higher than that (with IPv6). */
+	unsigned char buffer[20];	/* Can't go higher than that (with IPv6). */
 	size_t msg_len, data_len;
 	struct socks5_request msg;
 	struct socks5_request_resolve_ptr req;
diff --git a/src/common/socks5.h b/src/common/socks5.h
index 67da3aa..e2ca52f 100644
--- a/src/common/socks5.h
+++ b/src/common/socks5.h
@@ -92,14 +92,14 @@ struct socks5_request_ipv6 {
 struct socks5_request_domain {
 	uint8_t len;
 	/* Maximum size of len above. No NULL byte is needed. */
-	char name[UINT8_MAX];
+	unsigned char name[UINT8_MAX];
 	uint16_t port;
 };
 
 /* Use for the Tor resolve command. */
 struct socks5_request_resolve {
 	uint8_t len;
-	char name[UINT8_MAX];
+	unsigned char name[UINT8_MAX];
 };
 
 /* Use for the Tor resolve ptr command. */





More information about the tor-commits mailing list