From 406737e5aa38f90b01aebe2f6295e7b4ef828220 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 16 Sep 2008 21:06:10 +0200 Subject: ftfw: check for malformed ack and nack messages This patch checks that the [from, to] interval of ack and nack messages is OK. In other words, we check that: to >= from Signed-off-by: Pablo Neira Ayuso --- src/sync-ftfw.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c index 42005c4..cc8a08c 100644 --- a/src/sync-ftfw.c +++ b/src/sync-ftfw.c @@ -302,6 +302,10 @@ static int digest_msg(const struct nethdr *net) dprint("ACK(%u): from seq=%u to seq=%u\n", h->seq, h->from, h->to); + + if (before(h->to, h->from)) + return MSG_BAD; + rs_list_empty(STATE_SYNC(internal), h->from, h->to); queue_iterate(rs_queue, h, rs_queue_empty); return MSG_CTL; @@ -311,6 +315,10 @@ static int digest_msg(const struct nethdr *net) dprint("NACK(%u): from seq=%u to seq=%u\n", nack->seq, nack->from, nack->to); + + if (before(nack->to, nack->from)) + return MSG_BAD; + rs_list_to_tx(STATE_SYNC(internal), nack->from, nack->to); queue_iterate(rs_queue, nack, rs_queue_to_tx); return MSG_CTL; -- cgit v1.2.3