From e06cd0c186c1a7ead4778aa09de7db69c649f1a5 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 8 Jun 2018 11:08:15 +0200 Subject: lib: Fix bad bounds calculation in frct Since the seqno is further ahead than the lwe (this was checked before), we can safely use seqno - lwe in unsigned arithmetic as the distance in the sequence number space. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/frct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/frct.c b/src/lib/frct.c index 00261272..296d5b2c 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -385,7 +385,7 @@ static int __frcti_rcv(struct frcti * frcti, if (rcv_cr->cflags & FRCTFRTX) { size_t pos = seqno & (RQ_SIZE - 1); - if ((seqno - RQ_SIZE - rcv_cr->lwe) > 0 /* Out of rq. */ + if ((seqno - rcv_cr->lwe) > RQ_SIZE /* Out of rq. */ || frcti->rq[pos] != -1) /* Duplicate in rq. */ goto drop_packet; /* Queue. */ -- cgit v1.2.3