Commit f1ae0683 authored by Simon Morlat's avatar Simon Morlat

Fix several invalid reads in tester, and potential crash and use of...

Fix several invalid reads in tester, and potential crash and use of unitialized value in http proxy support.
parent 60b8ab63
Pipeline #257 failed with stage
in 0 seconds
......@@ -612,8 +612,8 @@ static int tls_process_data(belle_sip_channel_t *obj,unsigned int revents){
if (tls_process_handshake(obj)==-1) goto process_error;
}
} else if (obj->stack->http_proxy_host && !channel->http_proxy_connected) {
char response[256];
err = stream_channel_recv((belle_sip_stream_channel_t*)obj,response,sizeof(response));
char response[256]={0};
err = stream_channel_recv((belle_sip_stream_channel_t*)obj,response,sizeof(response)-1);
if (err<0 ){
belle_sip_error("Channel [%p]: connection refused by http proxy [%s:%i] status [%s]"
,channel
......
......@@ -268,10 +268,11 @@ static void process_auth_requested_for_algorithm(void *user_ctx, belle_sip_auth_
}
}
static const char *listener_user_data[2] = {NULL, NULL};
int register_before_all(void) {
belle_sip_listening_point_t *lp;
stack = belle_sip_stack_new(NULL);
const char *client[2] = {NULL, NULL};
belle_sip_tester_set_dns_host_file(stack);
......@@ -299,7 +300,7 @@ int register_before_all(void) {
listener_callbacks.process_auth_requested = process_auth_requested_for_algorithm;
listener_callbacks.listener_destroyed = NULL;
listener = belle_sip_listener_create_from_callbacks(&listener_callbacks, (void *)client);
listener = belle_sip_listener_create_from_callbacks(&listener_callbacks, (void *)listener_user_data);
return 0;
}
......
......@@ -183,7 +183,7 @@ void belle_sip_tester_set_dns_host_file(belle_sip_stack_t *stack){
if (userhostsfile){
belle_sip_stack_set_dns_user_hosts_file(stack, userhostsfile);
}else{
char *default_hosts = bc_tester_res("test_hosts");
char *default_hosts = bc_tester_res("tester_hosts");
if (default_hosts){
belle_sip_stack_set_dns_user_hosts_file(stack, default_hosts);
bc_free(default_hosts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment