mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:32:45 +01:00
core: thread: Added stack size validation
This commit is contained in:
parent
bad2b5c187
commit
4f5bea7d99
@ -146,6 +146,9 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
|
||||
/* round down the stacksize to a multiple of thread_t alignments (usually 16/32bit) */
|
||||
stacksize -= stacksize % ALIGN_OF(thread_t);
|
||||
|
||||
if (stacksize < 0) {
|
||||
DEBUG("thread_create: stacksize is too small!\n");
|
||||
}
|
||||
/* allocate our thread control block at the top of our stackspace */
|
||||
thread_t *cb = (thread_t *) (stack + stacksize);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user