summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-06-08 11:08:15 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-06-08 11:33:08 +0200
commite06cd0c186c1a7ead4778aa09de7db69c649f1a5 (patch)
treea703a763c64d7f12a8b87c5ff1c165cd6bfa9d66 /src/lib
parent53df1996a817f270f81cc397edeaf2c0e7929721 (diff)
downloadouroboros-e06cd0c186c1a7ead4778aa09de7db69c649f1a5.tar.gz
ouroboros-e06cd0c186c1a7ead4778aa09de7db69c649f1a5.zip
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 <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/frct.c2
1 files changed, 1 insertions, 1 deletions
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. */