mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-01-31 20:29:36 +08:00
fix bad memorry access
This commit is contained in:
parent
0e37c1fea4
commit
5f907e32d7
@ -291,6 +291,7 @@ int padding(char *data ,int &data_len,int padding_num)
|
|||||||
|
|
||||||
int de_padding(const char *data ,int &data_len,int padding_num)
|
int de_padding(const char *data ,int &data_len,int padding_num)
|
||||||
{
|
{
|
||||||
|
if(data_len==0) return -1;
|
||||||
if((uint8_t)data[data_len-1] >padding_num) return -1;
|
if((uint8_t)data[data_len-1] >padding_num) return -1;
|
||||||
data_len-=(uint8_t)data[data_len-1];
|
data_len-=(uint8_t)data[data_len-1];
|
||||||
if(data_len<0)
|
if(data_len<0)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
int server_on_timer_multi(conn_info_t &conn_info) //for server. called when a timer is ready in epoll.for server,there will be one timer for every connection
|
int server_on_timer_multi(conn_info_t &conn_info) //for server. called when a timer is ready in epoll.for server,there will be one timer for every connection
|
||||||
// there is also a global timer for server,but its not handled here
|
// there is also a global timer for server,but its not handled here
|
||||||
{
|
{
|
||||||
char ip_port[40];
|
char ip_port[max_addr_len];
|
||||||
//u32_t ip=conn_info.raw_info.send_info.dst_ip;
|
//u32_t ip=conn_info.raw_info.send_info.dst_ip;
|
||||||
//u32_t port=conn_info.raw_info.send_info.dst_port;
|
//u32_t port=conn_info.raw_info.send_info.dst_port;
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ int server_on_raw_recv_multi() //called when server received an raw packet
|
|||||||
address_t addr;
|
address_t addr;
|
||||||
addr.from_ip_port_new(raw_ip_version,&peek_info.new_src_ip,peek_info.src_port);
|
addr.from_ip_port_new(raw_ip_version,&peek_info.new_src_ip,peek_info.src_port);
|
||||||
|
|
||||||
char ip_port[40];
|
char ip_port[max_addr_len];
|
||||||
addr.to_str(ip_port);
|
addr.to_str(ip_port);
|
||||||
//sprintf(ip_port,"%s:%d",my_ntoa(ip),port);
|
//sprintf(ip_port,"%s:%d",my_ntoa(ip),port);
|
||||||
mylog(log_trace,"[%s]peek_raw\n",ip_port);
|
mylog(log_trace,"[%s]peek_raw\n",ip_port);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user