Make character types unsigned for compatibility with telnet codes.

This commit is contained in:
Chris Osborn 2019-08-09 08:15:48 -07:00
parent 0c9ddef99f
commit 2ad04a048e
9 changed files with 23 additions and 23 deletions

View File

@ -52,7 +52,7 @@ 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;
int ch;
char text[1025];
unsigned char text[1025];
int text_len = 0;

View File

@ -52,7 +52,7 @@ void log_set_file(FILE * a);
void log_set_level(int a);
int log_get_trace_flags();
void log_set_trace_flags(int a);
void log_trace(int type, char *line, int len);
void log_trace(int type, unsigned char *line, int len);
void log_start(int level);
void log_end();

View File

@ -11,7 +11,7 @@ extern int ip_init_server_conn(char *ip_addr, int port);
extern int ip_connect(char addy[]);
extern int ip_accept(int sSocket);
extern int ip_disconnect(int fd);
extern int ip_write(int fd, char *data, int len);
extern int ip_read(int fd, char *data, int len);
extern int ip_write(int fd, unsigned char *data, int len);
extern int ip_read(int fd, unsigned char *data, int len);
#endif

View File

@ -133,7 +133,7 @@ int ip232_get_control_lines(modem_config *cfg)
int ip232_set_control_lines(modem_config *cfg, int state)
{
int dcd;
char cmd[2];
unsigned char cmd[2];
if (cfg->dce_data.ip232_is_connected) {
@ -148,12 +148,12 @@ int ip232_set_control_lines(modem_config *cfg, int state)
return 0;
}
int ip232_write(modem_config *cfg, char *data, int len)
int ip232_write(modem_config *cfg, unsigned char *data, int len)
{
int retval;
int i = 0;
int double_iac = FALSE;
char text[1024];
unsigned char text[1024];
int text_len = 0;
@ -187,11 +187,11 @@ int ip232_write(modem_config *cfg, char *data, int len)
return retval;
}
int ip232_read(modem_config *cfg, char *data, int len)
int ip232_read(modem_config *cfg, unsigned char *data, int len)
{
int res;
int rc;
char buf[256];
unsigned char buf[256];
int i = 0;
int ch;
int text_len = 0;

View File

@ -12,7 +12,7 @@ int ip232_init_conn(modem_config *);
int ip232_set_flow_control(modem_config *, int status);
int ip232_get_control_lines(modem_config *);
int ip232_set_control_lines(modem_config *, int state);
int ip232_write(modem_config *, char *data, int len);
int ip232_read(modem_config *, char *data, int len);
int ip232_write(modem_config *, unsigned char *data, int len);
int ip232_read(modem_config *, unsigned char *data, int len);
#endif /* */

View File

@ -20,7 +20,7 @@ int line_write(modem_config *cfg, char *data, int len)
int retval;
int i = 0;
int double_iac = FALSE;
char text[1024];
unsigned char text[1024];
int text_len = 0;
int mask = 0x7f;
int ch;

View File

@ -154,7 +154,7 @@ int get_new_cts_state(modem_config *cfg, int up);
int get_new_dsr_state(modem_config *cfg, int up);
int get_new_dcd_state(modem_config *cfg, int up);
int mdm_set_control_lines(modem_config *cfg);
void mdm_write(modem_config *cfg, char data[], int len);
void mdm_write(modem_config *cfg, unsigned char data[], int len);
void mdm_send_response(int msg, modem_config *cfg);
int mdm_off_hook(modem_config *cfg);
int mdm_answer(modem_config *cfg);

View File

@ -19,7 +19,7 @@ void nvt_init_config(nvt_vars *vars)
int get_nvt_cmd_response(int action, int type)
{
char rc = 0;
unsigned char rc = 0;
if (type == TRUE) {
@ -57,8 +57,8 @@ int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, i
{
// overflow issue, again...
nvtOption opt = data[2];
char resp[100];
char *response = resp + 3;
unsigned char resp[100];
unsigned char *response = resp + 3;
int resp_len = 0;
int response_len = 0;
char tty_type[] = "VT100";
@ -86,14 +86,14 @@ int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, i
switch (opt) {
case NVT_OPT_TERMINAL_TYPE:
slen = strlen(tty_type);
strncpy(response + response_len, tty_type, slen);
strncpy((char *) response + response_len, tty_type, slen);
response_len += slen;
break;
case NVT_OPT_TERMINAL_SPEED:
sprintf(buf, "%i,%i", speed, speed);
slen = strlen(buf);
strncpy(response + response_len, buf, slen);
strncpy((char *) response + response_len, buf, slen);
response_len += slen;
break;
@ -120,9 +120,9 @@ int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, i
return rc;
}
void send_nvt_command(int fd, nvt_vars *vars, char action, int opt)
void send_nvt_command(int fd, nvt_vars *vars, unsigned char action, int opt)
{
char cmd[3];
unsigned char cmd[3];
cmd[0] = NVT_IAC;
@ -137,7 +137,7 @@ void send_nvt_command(int fd, nvt_vars *vars, char action, int opt)
void parse_nvt_command(int fd, nvt_vars *vars, nvtCommand action, nvtOption opt, int parity)
{
char resp[3];
unsigned char resp[3];
int accept = FALSE;

View File

@ -45,13 +45,13 @@ typedef enum {
typedef struct nvt_vars {
int binary_xmit;
int binary_recv;
char term[256];
unsigned char term[256];
} nvt_vars;
extern void nvt_init_config(nvt_vars *vars);
extern int get_nvt_cmd_response(int action, int type);
extern int parse_nvt_subcommand(int fd, nvt_vars *vars, unsigned char *data, int len, int speed);
extern void send_nvt_command(int fd, nvt_vars *vars, char action, int opt);
extern void send_nvt_command(int fd, nvt_vars *vars, unsigned char action, int opt);
extern void parse_nvt_command(int fd, nvt_vars *vars, nvtCommand action, nvtOption opt, int parity);
#endif