diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-13 06:44:15 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-13 06:44:15 -0600 |
commit | a41d1de84e43d281a81f2e109e69fcbf65bbdc92 (patch) | |
tree | 84a3f8252e7126071bdd6fc85dc56a5f9fb17617 /nuttx/sched/task | |
parent | 725f4deb901ede258944bbd9c0cab44ff17bafa8 (diff) | |
download | px4-nuttx-a41d1de84e43d281a81f2e109e69fcbf65bbdc92.tar.gz px4-nuttx-a41d1de84e43d281a81f2e109e69fcbf65bbdc92.tar.bz2 px4-nuttx-a41d1de84e43d281a81f2e109e69fcbf65bbdc92.zip |
task_create: Don't even try if the accumulated size of the argument list is larger than the stack
Diffstat (limited to 'nuttx/sched/task')
-rw-r--r-- | nuttx/sched/task/task_setup.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nuttx/sched/task/task_setup.c b/nuttx/sched/task/task_setup.c index 7320cf19d..03ee33017 100644 --- a/nuttx/sched/task/task_setup.c +++ b/nuttx/sched/task/task_setup.c @@ -490,9 +490,16 @@ static inline int task_stackargsetup(FAR struct task_tcb_s *tcb, while (argv[argc]) { - /* Add the size of this argument (with NUL terminator) */ + /* Add the size of this argument (with NUL terminator). + * Check each time if the accumulated size exceeds the + * size of the allocated stack. + */ strtablen += (strlen(argv[argc]) + 1); + if (strtablen >= tcb->adj_stack_size) + { + return -ENAMETOOLONG; + } /* Increment the number of args. Here is a sanity check to * prevent running away with an unterminated argv[] list. |