Compilation fixes for older C compilers
This commit is contained in:
@@ -1200,15 +1200,20 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
|
|||||||
}
|
}
|
||||||
/* SERVICE_LOCATION */
|
/* SERVICE_LOCATION */
|
||||||
else if(is_ndpi_proto(flow, NDPI_PROTOCOL_SERVICE_LOCATION)) {
|
else if(is_ndpi_proto(flow, NDPI_PROTOCOL_SERVICE_LOCATION)) {
|
||||||
|
size_t i;
|
||||||
|
|
||||||
flow->info_type = INFO_GENERIC;
|
flow->info_type = INFO_GENERIC;
|
||||||
flow->info[0] = 0;
|
flow->info[0] = 0;
|
||||||
if (flow->ndpi_flow->protos.slp.url_count > 0)
|
if (flow->ndpi_flow->protos.slp.url_count > 0)
|
||||||
strncat(flow->info, "URL(s): ", sizeof(flow->info));
|
strncat(flow->info, "URL(s): ", sizeof(flow->info));
|
||||||
for (size_t i = 0; i < flow->ndpi_flow->protos.slp.url_count; ++i) {
|
|
||||||
|
for (i = 0; i < flow->ndpi_flow->protos.slp.url_count; ++i) {
|
||||||
size_t length = strlen(flow->info);
|
size_t length = strlen(flow->info);
|
||||||
|
|
||||||
strncat(flow->info + length, flow->ndpi_flow->protos.slp.url[i],
|
strncat(flow->info + length, flow->ndpi_flow->protos.slp.url[i],
|
||||||
sizeof(flow->info) - length);
|
sizeof(flow->info) - length);
|
||||||
length = strlen(flow->info);
|
length = strlen(flow->info);
|
||||||
|
|
||||||
if (i < (size_t)flow->ndpi_flow->protos.slp.url_count - 1)
|
if (i < (size_t)flow->ndpi_flow->protos.slp.url_count - 1)
|
||||||
strncat(flow->info + length, ", ", sizeof(flow->info) - length);
|
strncat(flow->info + length, ", ", sizeof(flow->info) - length);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ static int slp_dissect_url_entries(struct ndpi_detection_module_struct *ndpi_str
|
|||||||
struct ndpi_packet_struct const * const packet = &ndpi_struct->packet;
|
struct ndpi_packet_struct const * const packet = &ndpi_struct->packet;
|
||||||
struct slp_url_entry const *url_entry;
|
struct slp_url_entry const *url_entry;
|
||||||
uint16_t url_entries_count;
|
uint16_t url_entries_count;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
if (packet->payload_packet_len <= url_entries_offset + sizeof(uint16_t)) {
|
if (packet->payload_packet_len <= url_entries_offset + sizeof(uint16_t)) {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -151,7 +152,7 @@ static int slp_dissect_url_entries(struct ndpi_detection_module_struct *ndpi_str
|
|||||||
url_entries_count = ntohs(*(uint16_t *)&packet->payload[url_entries_offset]);
|
url_entries_count = ntohs(*(uint16_t *)&packet->payload[url_entries_offset]);
|
||||||
url_entries_offset += sizeof(uint16_t);
|
url_entries_offset += sizeof(uint16_t);
|
||||||
|
|
||||||
for (size_t i = 0; i < ndpi_min(url_entries_count, NDPI_ARRAY_LENGTH(flow->protos.slp.url)); ++i) {
|
for (i = 0; i < ndpi_min(url_entries_count, NDPI_ARRAY_LENGTH(flow->protos.slp.url)); ++i) {
|
||||||
if (packet->payload_packet_len < url_entries_offset + sizeof(*url_entry)) {
|
if (packet->payload_packet_len < url_entries_offset + sizeof(*url_entry)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -171,7 +172,8 @@ static int slp_dissect_url_entries(struct ndpi_detection_module_struct *ndpi_str
|
|||||||
|
|
||||||
// handle Authentication Blocks
|
// handle Authentication Blocks
|
||||||
uint8_t num_auths = packet->payload[url_entries_offset++];
|
uint8_t num_auths = packet->payload[url_entries_offset++];
|
||||||
for (size_t j = 0; j < num_auths; ++j) {
|
size_t j;
|
||||||
|
for (j = 0; j < num_auths; ++j) {
|
||||||
size_t auth_block_offset = url_entries_offset + 2;
|
size_t auth_block_offset = url_entries_offset + 2;
|
||||||
if (packet->payload_packet_len <= auth_block_offset + 2) {
|
if (packet->payload_packet_len <= auth_block_offset + 2) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user