Skip to content

Commit 7111cf1

Browse files
committed
Skipping fifo_space, checking fifo_push ret val
(Spotted in peer review)
1 parent 0a3827d commit 7111cf1

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/wolfip.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,11 +2341,10 @@ static void raw_try_recv(struct wolfIP *s, unsigned int if_idx, struct wolfIP_ip
23412341
continue;
23422342
if (r->protocol != 0 && r->protocol != ip->proto)
23432343
continue;
2344-
if (fifo_space(&r->rxbuf) < payload_len + sizeof(struct pkt_desc))
2345-
continue;
2346-
fifo_push(&r->rxbuf, (void *)packet, payload_len);
2347-
r->last_pkt_ttl = ip->ttl;
2348-
r->events |= CB_EVENT_READABLE;
2344+
if (fifo_push(&r->rxbuf, (void *)packet, payload_len) == 0) {
2345+
r->last_pkt_ttl = ip->ttl;
2346+
r->events |= CB_EVENT_READABLE;
2347+
}
23492348
}
23502349
}
23512350
#endif

0 commit comments

Comments
 (0)