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++] = '.';
|
||||
|
||||
while(j < max_len && cl != 0) {
|
||||
u_int32_t shift;
|
||||
|
||||
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--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
for(j=0; j<i; j++)
|
||||
flow->host_server_name[j] = payload[k++];
|
||||
|
||||
for(j=0; j<i; j++) {
|
||||
if((k+i) < payload_length)
|
||||
flow->host_server_name[j] = payload[k++];
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_STUN
|
||||
printf("==> [%s]\n", flow->host_server_name);
|
||||
#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 = (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(!ndpi_struct->disable_metadata_export) {
|
||||
snprintf(flow->protos.stun_ssl.ssl.client_certificate,
|
||||
sizeof(flow->protos.stun_ssl.ssl.client_certificate), "%s", buffer);
|
||||
if((offset+extension_offset+5+len) < packet->payload_packet_len) {
|
||||
strncpy(buffer, (char*)&packet->payload[offset+extension_offset+5], len);
|
||||
buffer[len] = '\0';
|
||||
|
||||
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 */) {
|
||||
u_int16_t s_offset = offset+extension_offset + 2;
|
||||
|
||||
Reference in New Issue
Block a user