From 1f179e8b2b9197cf2ec8021eb5cc51e40719aaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Mon, 8 Jul 2019 11:23:51 +0300 Subject: [PATCH] Whoops --- ethermess.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ethermess.c b/ethermess.c index 954955c..ec99b3a 100644 --- a/ethermess.c +++ b/ethermess.c @@ -73,6 +73,12 @@ ssize_t msgid_cache_lookup(const unsigned char mac[6]) { ssize_t msgid_cache_add(const unsigned char mac[6]) { ssize_t index = next_slot++; + // If we are adding into a new slot (instead of overwriting one), + // expand the fill pointer + if (msgid_cache_fill < index) { + msgid_cache_fill++; + } + memcpy(msgid_cache[index].other_mac, mac, sizeof(msgid_cache[index].other_mac)); msgid_cache[index].know_send = false; msgid_cache[index].know_receive = false;