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) if (channel == DATA)
{ {
family = get_u_int16_t(packet->payload, 6); family = get_u_int16_t(packet->payload, 6);
type = get_u_int16_t(packet->payload, 8); if (packet->payload_packet_len >= 10)
flag = get_u_int16_t(packet->payload, 10); type = get_u_int16_t(packet->payload, 8);
req_ID = get_u_int32_t(packet->payload, 12); else
type = 0;
/* Family 0x0001 */ /* Family 0x0001 */
if (family == htons(GE_SE_CTL)) if (family == htons(GE_SE_CTL))
@@ -561,16 +562,24 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
} }
/* flag */ /* flag */
if (flag == htons(0x0000)|| flag == htons(0x8000) || flag == htons(0x0001)) if (packet->payload_packet_len >= 12)
{ {
/* request ID */ flag = get_u_int16_t(packet->payload, 10);
if((req_ID <= 4294967295)) 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"); /* request ID */
ndpi_int_oscar_add_connection(ndpi_struct, flow); req_ID = get_u_int32_t(packet->payload, 12);
return; 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 ERROR -> FLAP__ERROR_CHANNEL_0x03