add break condition into a possible endless loop
This commit is contained in:
parent
440b87f92e
commit
5bb9e2f066
1 changed files with 4 additions and 0 deletions
|
@ -232,6 +232,7 @@ static err_t rckemacif_output(struct netif* netif, struct pbuf* p)
|
|||
int rest;
|
||||
int packets;
|
||||
int sum = 0;
|
||||
int chance = 20;
|
||||
|
||||
/* check for over/underflow */
|
||||
if (BUILTIN_EXPECT((p->tot_len < 20 /* IP header size */) || (p->tot_len > 1536), 0)) {
|
||||
|
@ -257,6 +258,9 @@ again:
|
|||
|
||||
if (sum < packets) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("Warning: not enough space available, retrying...\n"));
|
||||
chance--;
|
||||
if (chance < 0)
|
||||
return ERR_MEM;
|
||||
goto again;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue