From: Fernando Alves Date: Sun, 17 Sep 2023 12:41:05 +0000 (+0200) Subject: fix infinite loop X-Git-Tag: 2.2.1.2fdn3.22~3 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/ac381e055bf6c0016b5e0246cf30378209f11233 fix infinite loop --- diff --git a/l2tpns.c b/l2tpns.c index 152c8ec..5947561 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -2716,7 +2716,14 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr, uint16_t indexu result = 2; // general error error = 3; // reserved field non-zero msg = 0; - continue; // next + if (n == 0) + { + // if continue a infinity loop is created. + LOG(1, s, t, "It's infinite loop protection %02X\n", *b); + return; + } + else + continue; // next } b += 2; if (*(uint16_t *) (b)) @@ -2726,7 +2733,14 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr, uint16_t indexu result = 2; // general error error = 6; // generic vendor-specific error msg = "unsupported vendor-specific"; - continue; // next + if (n == 0) + { + // if continue a infinity loop is created. + LOG(1, s, t, "It's infinite loop protection %02X\n", *b); + return; + } + else + continue; // next } b += 2; mtype = ntohs(*(uint16_t *) (b));