aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/protocols/oscar.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/lib/protocols/oscar.c b/src/lib/protocols/oscar.c
index a43394a8d..8be944993 100644
--- a/src/lib/protocols/oscar.c
+++ b/src/lib/protocols/oscar.c
@@ -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