summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFrancois Berder <fberder@outlook.fr>2025-11-22 21:45:02 +0100
committerTom Rini <trini@konsulko.com>2025-12-05 16:23:54 -0600
commit43ca62bf1943eb3e170cd408be0d2c2a2404b4c2 (patch)
tree2b516addf799349cffdf4d2f43e149310cb91996 /examples
parent1c1be32c31cbec61d32f7aaa498ccc25567ae3e0 (diff)
examples: Fix checking id parameter in thread_start
lthreads is of size MAX_THREADS, hence id must be lower than MAX_THREADS to avoid any potential buffer overflow in thread_start function. Signed-off-by: Francois Berder <fberder@outlook.fr>
Diffstat (limited to 'examples')
-rw-r--r--examples/standalone/sched.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/standalone/sched.c b/examples/standalone/sched.c
index 57ae67e1a5b..64518c6890f 100644
--- a/examples/standalone/sched.c
+++ b/examples/standalone/sched.c
@@ -261,9 +261,8 @@ static void thread_launcher (void)
static int thread_start (int id)
{
PDEBUG ("thread_start: id=%d", id);
- if (id <= MASTER_THREAD || id > MAX_THREADS) {
+ if (id <= MASTER_THREAD || id >= MAX_THREADS)
return RC_FAILURE;
- }
if (lthreads[id].state != STATE_STOPPED)
return RC_FAILURE;