app-layer: don't wrap around on port 65535

A port value of 65535 caused the port value to wrap-around to 0
resulting in an infinite loop.

Fixes: 53fc70a9a7 ("protodetect: fix int warnings")
pull/7730/head
Jason Ish 4 years ago committed by Victor Julien
parent c8cf25a21a
commit f1f43cba5e

@ -1708,7 +1708,7 @@ void AppLayerProtoDetectPPRegister(uint8_t ipproto,
uint16_t port = temp_dp->port; uint16_t port = temp_dp->port;
if (port == 0 && temp_dp->port2 != 0) if (port == 0 && temp_dp->port2 != 0)
port++; port++;
for ( ; port <= temp_dp->port2; port++) { for (;;) {
AppLayerProtoDetectInsertNewProbingParser(&alpd_ctx.ctx_pp, AppLayerProtoDetectInsertNewProbingParser(&alpd_ctx.ctx_pp,
ipproto, ipproto,
port, port,
@ -1717,6 +1717,11 @@ void AppLayerProtoDetectPPRegister(uint8_t ipproto,
direction, direction,
ProbingParser1, ProbingParser1,
ProbingParser2); ProbingParser2);
if (port == temp_dp->port2) {
break;
} else {
port++;
}
} }
temp_dp = temp_dp->next; temp_dp = temp_dp->next;
} }

Loading…
Cancel
Save