From 3ee549e2e3abd34af91dae87d3f1f544d68c9172 Mon Sep 17 00:00:00 2001 From: Chris Osborn Date: Thu, 7 Jul 2016 10:48:31 -0700 Subject: [PATCH] Fix signed/unsigned problems when looking for telnet IAC. --- src/bridge.c | 6 +++--- src/bridge.h | 2 +- src/nvt.c | 2 +- src/nvt.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bridge.c b/src/bridge.c index 5a488e9..410eeb0 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -47,7 +47,7 @@ int accept_connection(modem_config *cfg) return 0; } -int parse_ip_data(modem_config *cfg, char *data, int len) +int parse_ip_data(modem_config *cfg, unsigned char *data, int len) { // I'm going to cheat and assume it comes in chunks. int i = 0; @@ -114,7 +114,7 @@ int parse_ip_data(modem_config *cfg, char *data, int len) } } else { - mdm_write(cfg, data, len); + mdm_write(cfg, (char *) data, len); } return 0; } @@ -163,7 +163,7 @@ void *ip_thread(void *arg) LOG(LOG_DEBUG, "Read %d bytes from socket", res); buf[res] = 0; log_trace(TRACE_IP_IN, buf, res); - parse_ip_data(cfg, buf, res); + parse_ip_data(cfg, (unsigned char *) buf, res); } } if (FD_ISSET(cfg->data.cp[1][0], &readfs)) { // pipe diff --git a/src/bridge.h b/src/bridge.h index 93f2a96..765dc22 100644 --- a/src/bridge.h +++ b/src/bridge.h @@ -16,5 +16,5 @@ #define MSG_NOTIFY 'N' int accept_connection(modem_config *); -int parse_ip_data(modem_config *cfg, char *data, int len); +int parse_ip_data(modem_config *cfg, unsigned char *data, int len); void *run_bridge(void *arg); diff --git a/src/nvt.c b/src/nvt.c index 67a854c..c81ed93 100644 --- a/src/nvt.c +++ b/src/nvt.c @@ -53,7 +53,7 @@ int get_nvt_cmd_response(int action, int type) return rc; } -int parse_nvt_subcommand(int fd, nvt_vars *vars, char *data, int len, int speed) +int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, int speed) { // overflow issue, again... nvtOption opt = data[2]; diff --git a/src/nvt.h b/src/nvt.h index c606417..b89c071 100644 --- a/src/nvt.h +++ b/src/nvt.h @@ -49,7 +49,7 @@ typedef struct nvt_vars { } nvt_vars; extern int get_nvt_cmd_response(int action, int type); -extern int parse_nvt_subcommand(int fd, nvt_vars *vars, char *data, int len, int speed); +extern int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, int speed); extern int parse_nvt_command(int fd, nvt_vars *vars, nvtCommand action, nvtOption opt, int parity); extern int nvt_init_config(nvt_vars *vars); extern int send_nvt_command(int fd, nvt_vars *vars, char action, int opt);