"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Francois Berder and committed by
Tom Rini
43ca62bf 1c1be32c

+1 -2
+1 -2
examples/standalone/sched.c
··· 261 261 static int thread_start (int id) 262 262 { 263 263 PDEBUG ("thread_start: id=%d", id); 264 - if (id <= MASTER_THREAD || id > MAX_THREADS) { 264 + if (id <= MASTER_THREAD || id >= MAX_THREADS) 265 265 return RC_FAILURE; 266 - } 267 266 268 267 if (lthreads[id].state != STATE_STOPPED) 269 268 return RC_FAILURE;