From: Mazet Laurent Date: Tue, 6 May 2025 15:28:31 +0000 (+0200) Subject: add tests on morep used flag X-Git-Tag: v1.0~29^2~14 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=1eb700d5763d759cd586dfb02f7ccc0e557c02b2;p=morep.git add tests on morep used flag --- 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; }