Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenVPN: fix a warning #2686

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/lib/protocols/openvpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ static int search_heur_opcode(struct ndpi_detection_module_struct* ndpi_struct,
u_int16_t ovpn_payload_len = packet->payload_packet_len;
int dir = packet->packet_direction;
u_int16_t pdu_len;
int rc, iter, offset;
int rc, offset;
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
int iter;
#endif

/* To reduce false positives number, trigger the heuristic only for flows to
suspicious/unknown addresses */
Expand Down Expand Up @@ -409,7 +412,9 @@ static int search_heur_opcode(struct ndpi_detection_module_struct* ndpi_struct,
offset = 0;
}

#ifdef NDPI_ENABLE_DEBUG_MESSAGES
iter = 0;
#endif
rc = 1; /* Exclude */
while(offset + 2 + 1 /* The first byte is the opcode */ <= ovpn_payload_len) {
pdu_len = ntohs((*(u_int16_t *)(ovpn_payload + offset)));
Expand All @@ -434,7 +439,9 @@ static int search_heur_opcode(struct ndpi_detection_module_struct* ndpi_struct,
flow->ovpn_heur_opcode__missing_bytes[dir]);
return 0; /* Continue */
}
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
iter++;
#endif
}
return rc;
} else {
Expand Down
Loading