diff --git a/encrypt.cpp b/encrypt.cpp index cc5a64f..e0e5243 100755 --- a/encrypt.cpp +++ b/encrypt.cpp @@ -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) { + if(data_len==0) return -1; if((uint8_t)data[data_len-1] >padding_num) return -1; data_len-=(uint8_t)data[data_len-1]; if(data_len<0) diff --git a/server.cpp b/server.cpp index 4b6de0a..1f3158f 100644 --- a/server.cpp +++ b/server.cpp @@ -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 // 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 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; 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); //sprintf(ip_port,"%s:%d",my_ntoa(ip),port); mylog(log_trace,"[%s]peek_raw\n",ip_port);