Fixed oscar buffer overflow

This commit is contained in:
theirix
2016-04-12 22:26:10 +03:00
parent c22d3d3cae
commit d7a2515093
+20 -11
View File
@@ -245,9 +245,10 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
if (channel == DATA)
{
family = get_u_int16_t(packet->payload, 6);
type = get_u_int16_t(packet->payload, 8);
flag = get_u_int16_t(packet->payload, 10);
req_ID = get_u_int32_t(packet->payload, 12);
if (packet->payload_packet_len >= 10)
type = get_u_int16_t(packet->payload, 8);
else
type = 0;
/* Family 0x0001 */
if (family == htons(GE_SE_CTL))
@@ -561,16 +562,24 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
}
/* flag */
if (flag == htons(0x0000)|| flag == htons(0x8000) || flag == htons(0x0001))
{
/* request ID */
if((req_ID <= 4294967295))
if (packet->payload_packet_len >= 12)
{
flag = get_u_int16_t(packet->payload, 10);
if (flag == htons(0x0000)|| flag == htons(0x8000) || flag == htons(0x0001))
{
if (packet->payload_packet_len >= 16)
{
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR Detected \n");
ndpi_int_oscar_add_connection(ndpi_struct, flow);
return;
/* request ID */
req_ID = get_u_int32_t(packet->payload, 12);
if((req_ID <= 4294967295))
{
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR Detected \n");
ndpi_int_oscar_add_connection(ndpi_struct, flow);
return;
}
}
}
}
}
}
/*
ERROR -> FLAP__ERROR_CHANNEL_0x03