Compare commits
3
Commits
dev
...
2.2-stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf06823189 | ||
|
|
56dcf659de | ||
|
|
f561e14271 |
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
NDPI_MAJOR="2"
|
NDPI_MAJOR="2"
|
||||||
NDPI_MINOR="1"
|
NDPI_MINOR="2"
|
||||||
NDPI_PATCH="0"
|
NDPI_PATCH="0"
|
||||||
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
|
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4642,11 +4642,11 @@ static const char* categories[] = {
|
|||||||
"Unspecified",
|
"Unspecified",
|
||||||
"Media",
|
"Media",
|
||||||
"VPN",
|
"VPN",
|
||||||
"DataTransfer",
|
|
||||||
"Email",
|
"Email",
|
||||||
"Download-FileTransfer-FileSharing",
|
"DataTransfer",
|
||||||
"Web",
|
"Web",
|
||||||
"SocialNetwork",
|
"SocialNetwork",
|
||||||
|
"Download-FileTransfer-FileSharing",
|
||||||
"Game",
|
"Game",
|
||||||
"Chat",
|
"Chat",
|
||||||
"VoIP",
|
"VoIP",
|
||||||
|
|||||||
@@ -70,19 +70,24 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
|||||||
if(packet->udp) {
|
if(packet->udp) {
|
||||||
dhcp_packet_t *dhcp = (dhcp_packet_t*)packet->payload;
|
dhcp_packet_t *dhcp = (dhcp_packet_t*)packet->payload;
|
||||||
|
|
||||||
if((packet->payload_packet_len >= 244)
|
if((packet->payload_packet_len >= 244 /* 244 is the offset of options[0] in dhcp_packet_t */)
|
||||||
&& (packet->udp->source == htons(67) || packet->udp->source == htons(68))
|
&& (packet->udp->source == htons(67) || packet->udp->source == htons(68))
|
||||||
&& (packet->udp->dest == htons(67) || packet->udp->dest == htons(68))
|
&& (packet->udp->dest == htons(67) || packet->udp->dest == htons(68))
|
||||||
&& (dhcp->magic == htonl(DHCP_OPTION_MAGIC_NUMBER))) {
|
&& (dhcp->magic == htonl(DHCP_OPTION_MAGIC_NUMBER))) {
|
||||||
int i = 0, foundValidMsgType = 0;
|
u_int i = 0, foundValidMsgType = 0;
|
||||||
|
|
||||||
while(i < DHCP_VEND_LEN) {
|
u_int dhcp_options_size = ndpi_min(DHCP_VEND_LEN /* maximum size of options in dhcp_packet_t */,
|
||||||
|
packet->payload_packet_len - 244);
|
||||||
|
|
||||||
|
while(i + 1 /* for the len */ < dhcp_options_size) {
|
||||||
u_int8_t id = dhcp->options[i];
|
u_int8_t id = dhcp->options[i];
|
||||||
|
|
||||||
if(id == 0xFF)
|
if(id == 0xFF)
|
||||||
break;
|
break;
|
||||||
else {
|
else {
|
||||||
u_int8_t len = dhcp->options[i+1];
|
/* Prevent malformed packets to cause out-of-bounds accesses */
|
||||||
|
u_int8_t len = ndpi_min(dhcp->options[i+1] /* len as found in the packet */,
|
||||||
|
dhcp_options_size - (i+2) /* 1 for the type and 1 for the value */);
|
||||||
|
|
||||||
if(len == 0) break;
|
if(len == 0) break;
|
||||||
|
|
||||||
@@ -98,12 +103,14 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
|||||||
u_int idx, offset = 0,
|
u_int idx, offset = 0,
|
||||||
hex_len = ndpi_min(len * 2, sizeof(flow->protos.dhcp.fingerprint));
|
hex_len = ndpi_min(len * 2, sizeof(flow->protos.dhcp.fingerprint));
|
||||||
|
|
||||||
for(idx=0; idx<len; idx++) {
|
for(idx = 0; idx < len && offset < sizeof(flow->protos.dhcp.fingerprint) - 2; idx++) {
|
||||||
snprintf((char*)&flow->protos.dhcp.fingerprint[offset],
|
snprintf((char*)&flow->protos.dhcp.fingerprint[offset],
|
||||||
sizeof(flow->protos.dhcp.fingerprint)-offset-1,
|
sizeof(flow->protos.dhcp.fingerprint) - offset,
|
||||||
"%02X", dhcp->options[i+2+idx] & 0xFF);
|
"%02X", dhcp->options[i+2+idx] & 0xFF);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
}
|
}
|
||||||
|
flow->protos.dhcp.fingerprint[sizeof(flow->protos.dhcp.fingerprint) - 1] = '\0';
|
||||||
|
|
||||||
} else if(id == 60 /* Class Identifier */) {
|
} else if(id == 60 /* Class Identifier */) {
|
||||||
char *name = (char*)&dhcp->options[i+2];
|
char *name = (char*)&dhcp->options[i+2];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user