Fix signed/unsigned problems when looking for telnet IAC.

This commit is contained in:
Chris Osborn 2016-07-07 10:48:31 -07:00
parent 321b2ff260
commit 3ee549e2e3
4 changed files with 6 additions and 6 deletions

View File

@ -47,7 +47,7 @@ int accept_connection(modem_config *cfg)
return 0; 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. // I'm going to cheat and assume it comes in chunks.
int i = 0; int i = 0;
@ -114,7 +114,7 @@ int parse_ip_data(modem_config *cfg, char *data, int len)
} }
} }
else { else {
mdm_write(cfg, data, len); mdm_write(cfg, (char *) data, len);
} }
return 0; return 0;
} }
@ -163,7 +163,7 @@ void *ip_thread(void *arg)
LOG(LOG_DEBUG, "Read %d bytes from socket", res); LOG(LOG_DEBUG, "Read %d bytes from socket", res);
buf[res] = 0; buf[res] = 0;
log_trace(TRACE_IP_IN, buf, res); 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 if (FD_ISSET(cfg->data.cp[1][0], &readfs)) { // pipe

View File

@ -16,5 +16,5 @@
#define MSG_NOTIFY 'N' #define MSG_NOTIFY 'N'
int accept_connection(modem_config *); 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); void *run_bridge(void *arg);

View File

@ -53,7 +53,7 @@ int get_nvt_cmd_response(int action, int type)
return rc; 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... // overflow issue, again...
nvtOption opt = data[2]; nvtOption opt = data[2];

View File

@ -49,7 +49,7 @@ typedef struct nvt_vars {
} nvt_vars; } nvt_vars;
extern int get_nvt_cmd_response(int action, int type); 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 parse_nvt_command(int fd, nvt_vars *vars, nvtCommand action, nvtOption opt, int parity);
extern int nvt_init_config(nvt_vars *vars); extern int nvt_init_config(nvt_vars *vars);
extern int send_nvt_command(int fd, nvt_vars *vars, char action, int opt); extern int send_nvt_command(int fd, nvt_vars *vars, char action, int opt);