aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/oscar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/protocols/oscar.c')
-rw-r--r--src/lib/protocols/oscar.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/lib/protocols/oscar.c b/src/lib/protocols/oscar.c
index a43394a8d..869b36378 100644
--- a/src/lib/protocols/oscar.c
+++ b/src/lib/protocols/oscar.c
@@ -244,10 +244,19 @@ 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 >= 8)
+ family = get_u_int16_t(packet->payload, 6);
+ else
+ family = 0;
+ if (packet->payload_packet_len >= 10)
+ type = get_u_int16_t(packet->payload, 8);
+ else
+ type = 0;
+ if (family == 0 || type == 0)
+ {
+ NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_OSCAR);
+ return;
+ }
/* Family 0x0001 */
if (family == htons(GE_SE_CTL))
@@ -561,16 +570,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