1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
From 508098dafb5aed7f6a5f700856b35f9104985d1f Mon Sep 17 00:00:00 2001
From: Jari Aalto <jari.aalto@cante.net>
Date: Mon, 11 Oct 2010 12:59:26 +0300
Subject: [PATCH] Chnage 'buffer' from char to unsigned char. By Daniel Burr <dburr@topcon.com> in Debian bug #592202
Organization: Private
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
src/desproxy-dns.c | 10 +++++-----
src/desproxy-socksserver.c | 2 +-
src/desproxy.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/desproxy-dns.c b/src/desproxy-dns.c
index 5234fbb..685b610 100644
--- a/src/desproxy-dns.c
+++ b/src/desproxy-dns.c
@@ -57,6 +57,7 @@ answer_request (int connection, int size)
int count;
int htons_size;
char buffer[MAXREQUESTLEN + 2];
+ unsigned short int* ptr;
debug_printf (">answer_request(%d,%d)\n", connection, size);
if (connection == UDP_CONNECTION)
@@ -98,7 +99,8 @@ answer_request (int connection, int size)
perror ("read");
return (-3);
}
- size = ntohs (*((unsigned short int *) buffer));
+ ptr = (unsigned short int*)buffer;
+ size = ntohs (*ptr);
debug_printf ("size=%d\n", size);
if ((count = read (proxy_socket[connection], &buffer[2], size)) == -1)
{
@@ -258,10 +260,8 @@ main (int argc, char **argv)
requests[connection].bib + count;
if (requests[connection].bib > 2) // if at least 2 bib (Bytes In Buffer), we have request size
{
- requests[connection].size =
- htons (*
- ((unsigned short int *)
- &requests[connection].buffer[0]));
+ unsigned short int* ptr = (unsigned short int*)&requests[connection].buffer[0];
+ requests[connection].size = htons (*ptr);
if (requests[connection].size ==
requests[connection].bib - 2)
{
diff --git a/src/desproxy-socksserver.c b/src/desproxy-socksserver.c
index 74be64c..d930bfc 100644
--- a/src/desproxy-socksserver.c
+++ b/src/desproxy-socksserver.c
@@ -238,7 +238,7 @@ method_accepted_v5 (connection)
EOC (connection);
return;
}
- strncat (remote_host, buffer, 1);
+ strncat (remote_host, (char*)buffer, 1);
}
strncat (remote_host, "\x00", 1);
debug_printf ("remote_host %s\n", remote_host);
diff --git a/src/desproxy.h b/src/desproxy.h
index 290cd1b..97319a2 100644
--- a/src/desproxy.h
+++ b/src/desproxy.h
@@ -84,7 +84,7 @@ char username[256], password[256];
char console_line[256];
char HTTP_return_code[4];
char string[256];
-char buffer[BUFFER_SIZE];
+unsigned char buffer[BUFFER_SIZE];
unsigned char client_socket_is_free[MAX_CONNECTIONS];
fd_set mask, rmask;
--
1.7.1
|