From 1eb700d5763d759cd586dfb02f7ccc0e557c02b2 Mon Sep 17 00:00:00 2001 From: Mazet Laurent Date: Tue, 6 May 2025 17:28:31 +0200 Subject: [PATCH] add tests on morep used flag --- morep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/morep.c b/morep.c index d150dcf..41a39a0 100644 --- a/morep.c +++ b/morep.c @@ -362,7 +362,8 @@ int MOREP_Send (int index, uint8_t msgtype, uint8_t *buffer, int len) VERBOSE (morep, ERROR, PRINTF ("too large buffer to send (%d)\n", len)); return -1; } - if ((index < 0) || (index >= MAX_MOREP_NUMBER) || (MOREP_list[index] == NULL)) { + if ((index < 0) || (index >= MAX_MOREP_NUMBER) || + (MOREP_list[index] == NULL) || (!MOREP_list[index]->used)) { VERBOSE (morep, ERROR, PRINTF ("incorrect MOREP descriptor (%d)\n", index)); return -1; } @@ -403,7 +404,7 @@ int MOREP_Receive (int index, uint8_t *msgtype, uint8_t *buffer, int *len) *msgtype = 0; if (((index < 0) || (index >= MAX_MOREP_NUMBER)) || - (MOREP_list[index] == NULL)) { + (MOREP_list[index] == NULL) || (!MOREP_list[index]->used)) { VERBOSE (morep, ERROR, PRINTF ("incorrect MOREP descriptor (%d)\n", index)); return -1; } -- 2.30.2