Merge pull request #547 from zyingp/free-after-detect
Fix several bugs found by Address Sanitizer (ASan)
This commit is contained in:
@@ -663,7 +663,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
|
||||
/* Check for additional field introduced by Steam */
|
||||
int x = 1;
|
||||
if((memcmp(packet->line[x].ptr, "x-steam-sid", 11)) == 0) {
|
||||
if(packet->line[x].len >= 11 && (memcmp(packet->line[x].ptr, "x-steam-sid", 11)) == 0) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found STEAM\n");
|
||||
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_STEAM);
|
||||
check_content_type_and_change_protocol(ndpi_struct, flow);
|
||||
|
||||
@@ -442,15 +442,16 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
}
|
||||
NDPI_LOG_DBG(ndpi_struct, "msn 7\n");
|
||||
|
||||
if (flow->packet_counter <= MAX_PACKETS_FOR_MSN) {
|
||||
if (memcmp(&packet->payload[0], "MSG ", 4) == 0
|
||||
if (flow->packet_counter <= MAX_PACKETS_FOR_MSN) {
|
||||
if (packet->payload_packet_len >=4 && (memcmp(&packet->payload[0], "MSG ", 4) == 0
|
||||
|| memcmp(&packet->payload[0], "PNG", 3) == 0
|
||||
|| memcmp(&packet->payload[0], "QNG ", 4) == 0
|
||||
|| memcmp(&packet->payload[0], "OUT", 3) == 0
|
||||
|| memcmp(&packet->payload[0], "RNG ", 4) == 0
|
||||
|| memcmp(&packet->payload[0], "NLN ", 4) == 0
|
||||
|| memcmp(&packet->payload[0], "UBX ", 4) == 0
|
||||
|| memcmp(&packet->payload[0], "XFR ", 4) == 0) {
|
||||
|| memcmp(&packet->payload[0], "XFR ", 4) == 0)
|
||||
){
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
|
||||
NDPI_LOG_INFO(ndpi_struct, "found MSN\n");
|
||||
|
||||
@@ -31,7 +31,7 @@ int ndpi_is_ssl_tor(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
len = strlen(certificate);
|
||||
|
||||
/* Check if it ends in .com or .net */
|
||||
if(strcmp(&certificate[len-4], ".com") && strcmp(&certificate[len-4], ".net"))
|
||||
if(len>=4 && strcmp(&certificate[len-4], ".com") && strcmp(&certificate[len-4], ".net"))
|
||||
return(0);
|
||||
|
||||
if((len < 6)
|
||||
|
||||
Reference in New Issue
Block a user