Code cleanup
This commit is contained in:
@@ -279,8 +279,11 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st
|
|||||||
if(j && j < max_len) flow->host_server_name[j++] = '.';
|
if(j && j < max_len) flow->host_server_name[j++] = '.';
|
||||||
|
|
||||||
while(j < max_len && cl != 0) {
|
while(j < max_len && cl != 0) {
|
||||||
|
u_int32_t shift;
|
||||||
|
|
||||||
c = flow->packet.payload[off++];
|
c = flow->packet.payload[off++];
|
||||||
flow->host_server_name[j++] = tolower((dns_validchar[c >> 5] & (1 << (c & 0x1f))) ? c : '_');
|
shift = 1 << (c & 0x1f);
|
||||||
|
flow->host_server_name[j++] = tolower((dns_validchar[c >> 5] & shift) ? c : '_');
|
||||||
cl--;
|
cl--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,9 +350,13 @@ static ndpi_int_stun_t ndpi_int_check_stun(struct ndpi_detection_module_struct *
|
|||||||
|
|
||||||
memset(flow->host_server_name, 0, sizeof(flow->host_server_name));
|
memset(flow->host_server_name, 0, sizeof(flow->host_server_name));
|
||||||
|
|
||||||
for(j=0; j<i; j++)
|
for(j=0; j<i; j++) {
|
||||||
flow->host_server_name[j] = payload[k++];
|
if((k+i) < payload_length)
|
||||||
|
flow->host_server_name[j] = payload[k++];
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_STUN
|
#ifdef DEBUG_STUN
|
||||||
printf("==> [%s]\n", flow->host_server_name);
|
printf("==> [%s]\n", flow->host_server_name);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+10
-7
@@ -593,14 +593,17 @@ int getTLScertificate(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
|
|
||||||
len = (packet->payload[offset+extension_offset+3] << 8) + packet->payload[offset+extension_offset+4];
|
len = (packet->payload[offset+extension_offset+3] << 8) + packet->payload[offset+extension_offset+4];
|
||||||
len = (u_int)ndpi_min(len, buffer_len-1);
|
len = (u_int)ndpi_min(len, buffer_len-1);
|
||||||
strncpy(buffer, (char*)&packet->payload[offset+extension_offset+5], len);
|
|
||||||
buffer[len] = '\0';
|
|
||||||
|
|
||||||
stripCertificateTrailer(buffer, buffer_len);
|
if((offset+extension_offset+5+len) < packet->payload_packet_len) {
|
||||||
|
strncpy(buffer, (char*)&packet->payload[offset+extension_offset+5], len);
|
||||||
if(!ndpi_struct->disable_metadata_export) {
|
buffer[len] = '\0';
|
||||||
snprintf(flow->protos.stun_ssl.ssl.client_certificate,
|
|
||||||
sizeof(flow->protos.stun_ssl.ssl.client_certificate), "%s", buffer);
|
stripCertificateTrailer(buffer, buffer_len);
|
||||||
|
|
||||||
|
if(!ndpi_struct->disable_metadata_export) {
|
||||||
|
snprintf(flow->protos.stun_ssl.ssl.client_certificate,
|
||||||
|
sizeof(flow->protos.stun_ssl.ssl.client_certificate), "%s", buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if(extension_id == 10 /* supported groups */) {
|
} else if(extension_id == 10 /* supported groups */) {
|
||||||
u_int16_t s_offset = offset+extension_offset + 2;
|
u_int16_t s_offset = offset+extension_offset + 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user